Skip to main content

@mapgear/geoapps > Screen

Screen class

Represents a screen in a GeoApps app. The screen contains one or more blocks, and one or more settings, that can be used in the UI presentation. A screen can be configured and provisioned through the GeoApps Manager, or can be added by code.

Signature:
export declare class Screen 

Example

The following sample shows how a screen is added to an app

// Construct a new screen
const screen = new Screen();
screen.ScreenId = "f4675d22-e04c-436b-8b52-a7f222811e2b";
screen.Name = "Example screen";
screen.Type = "FULLSCREEN";
screen.Set("PURPOSE", "Demo"); // Sets a setting with the key 'Purpose'

console.log(screen.Get("PURPOSE")); // Will output "Demo";

// Adds the screen to the app
const app = geoapps.AddApp("Example", "<AppId>");
app.AddScreen(screen);

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the Screen class

Properties

PropertyModifiersTypeDescription
BlocksreadonlyBlock[]Blocks within screen
NamestringName of screen
ScreenIdstringUnique id of screen
TypestringType of screen. This can be used to identify the type of screen to load

Methods

MethodModifiersDescription
AddBlock(slot, block)Add a block to the specified slot
Get(key)Gets a setting by the specified key
GetBlockById(blockId)Gets block by screen id and block id
GetBlockBySlot(slot)Get the block that is linked to a specified slot
RemoveBlock(block)Remove a block from the screen
RemoveBlockBySlot(slot)Remove a block from a specified slot
Set(key, value)Add or update a setting