• Back to Glue42 Core Docs
Glue42 core documentation

Reference Documentation

  • Back to Glue42 Core Docs
Press/
  • Glue42 Web
  • AppManager
  • Channels
  • Intents
  • Interop
  • Layouts
  • Notifications
  • Shared Contexts
  • Themes
  • Windows
  • Workspaces

Layouts

2.20.0

The Layouts library has the following capabilities:

  • importing, exporting, removing and getting Layouts;
  • saving and restoring Layouts (exclusive to Glue42 Core+);
  • events related to adding, removing, changing or saving Layouts;
  • requesting browser permission for the Multi-Screen Window Placement API;

The Layouts API is accessible through the glue.layouts object.

APIobject

Description

Layouts API.

Methods

  • export
  • get
  • getAll
  • getGlobalTypeState
  • getMultiScreenPermissionState
  • import
  • onAdded
  • onChanged
  • onRemoved
  • onSaveRequested
  • remove
  • requestMultiScreenPermission
  • restore
  • save

exportmethod

Signature

(layoutType: LayoutType) => Promise<Layout[]>

Description

Returns a collection of all available Layout objects of the provided type.

Parameters

Name Type Required Description
layoutType LayoutType

getmethod

Signature

(name: string, type: LayoutType) => Promise<Layout>

Description

Fetches a saved Layout or returns undefined if a Layout with the provided name and type doesn't exist.

Parameters

Name Type Required Description
name string

Name of the Layout to fetch.

type LayoutType

Type of the Layout to fetch.

getAllmethod

Signature

(type: LayoutType) => Promise<LayoutSummary[]>

Description

Returns a lightweight description of all Layouts of the provided type, without the extensive objects describing the Layout components.

Parameters

Name Type Required Description
type LayoutType

Type of the Layouts to fetch.

getGlobalTypeStatemethod

Signature

() => Promise<{ activated: boolean; }>

Description

Checks whether Global Layouts are activated in the Glue42 Core+ environment.

getMultiScreenPermissionStatemethod

Signature

() => Promise<{ state: "prompt" | "granted" | "denied"; }>

Description

Retrieves the browser Multi-Screen Window Placement permission state for the Glue42 Core+ environment.

importmethod

Signature

(layouts: Layout[], mode?: ImportMode) => Promise<void>

Description

Imports a collection of Layout objects.

Parameters

Name Type Required Description
layouts Layout[]

An array of Layout objects to be imported.

mode ImportMode

If "replace" (default), all existing Layouts will be removed. If "merge", the Layouts will be added to the existing ones.

onAddedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a new Layout is added.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the Layout object as an argument and returns an unsubscribe function.

onChangedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a Layout is modified.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the Layout object as an argument and returns an unsubscribe function.

onRemovedmethod

Signature

(callback: (layout: Layout) => void) => () => void

Description

Notifies when a Layout is removed.

Parameters

Name Type Required Description
callback (layout: Layout) => void

Callback function to handle the event. Receives the Layout object as an argument and returns an unsubscribe function.

onSaveRequestedmethod

Signature

(callback: (info?: SaveRequestContext) => SaveRequestResponse) => () => void

Description

Subscribes for Layout save requests.

Parameters

Name Type Required Description
callback (info?: SaveRequestContext) => SaveRequestResponse

The callback passed as an argument will be invoked when a Layout save operation is requested. You have the option to save data (context) which will be restored when the Layout is restored. Returns an unsubscribe function.

removemethod

Signature

(type: LayoutType, name: string) => Promise<void>

Description

Removes a Layout.

Parameters

Name Type Required Description
type LayoutType

Type of the Layout to remove.

name string

Name of the Layout to remove.

requestMultiScreenPermissionmethod

Signature

() => Promise<{ permissionGranted: boolean; }>

Description

Opens the browser permission prompt requesting Multi-Screen Window Placement permission from the user for the Glue42 Core+ environment. This can only be requested from the Main app (Web Platform) due to the transient activation restrictions of the browsers.

restoremethod

Signature

(options: RestoreOptions) => Promise<void>

Description

Restores a Layout.

Parameters

Name Type Required Description
options RestoreOptions

Options for restoring a Layout.

savemethod

Signature

(layout: NewLayoutOptions) => Promise<Layout>

Description

Saves a new Layout.

Parameters

Name Type Required Description
layout NewLayoutOptions

Options for saving a Layout.

Layoutobject

Description

Describes a Layout and its components.

Properties

Property Type Default Required Description
components (WindowComponent | WorkspaceFrameComponent | WorkspaceComponent)[]

Array of component objects describing the apps and Workspaces saved in the Layout.

context any

Context object passed when the Layout was saved.

metadata any

Metadata passed when the Layout was saved.

name string

Name of the Layout. The name is unique per Layout type.

type LayoutType

Type of the Layout.

version number

Version of the Layout.

LayoutSummaryobject

Description

A lightweight description of a Layout, without the extensive objects describing its components.

Properties

Property Type Default Required Description
context any

Context object passed when the Layout was saved.

metadata any

Metadata passed when the Layout was saved.

name string

Name of the Layout. The name is unique per Layout type.

type LayoutType

Type of the Layout.

NewLayoutOptionsobject

Description

Options for saving a Layout.

Properties

Property Type Default Required Description
context any

Context to be saved with the Layout. Used for transferring data to the apps when restoring a Layout.

ignoreInstances string[]

Window or app instance IDs of the instances to be ignored when saving the Layout.

instances string[]

Window or app instance IDs of the instances to be saved in the Layout.

metadata any

Metadata to be saved with the Layout.

name string

Name for the Layout.

RestoreOptionsobject

Description

Options for restoring a Layout.

Properties

Property Type Default Required Description
closeMe boolean true

If true, will close the current app before restoring a Layout. If closeRunningInstances is set to false, this will default to false too.

closeRunningInstances boolean true

If true, will close all visible running instances before restoring the Layout. The only exception is the Main app (Web Platform) - it will never be closed when restoring a Layout.

context object

Context object that will be passed to the restored apps. It will be merged with the saved context object.

name string

Name of the Layout to restore.

timeout number 60000

Timeout in milliseconds for restoring the Layout. If the time limit is hit, all apps opened up to this point will be closed and an error will be thrown.

SaveRequestContextobject

Description

Object passed as an argument to the handler for a save Layout request.

Properties

Property Type Default Required Description
context unknown

Context for the Layout.

layoutName string

Name of the Layout.

layoutType LayoutType

Type of the Layout.

SaveRequestResponseobject

Description

Object returned by the handler for a save Layout request.

Properties

Property Type Default Required Description
windowContext object

Context to be saved for the specific app in the Layout.

ImportModeenumeration

Description

Controls the import behavior. If "replace" (default), all existing Layouts will be removed. If "merge", the Layouts will be added to the existing ones.

  • "replace"
  • "merge"

LayoutTypeenumeration

Description

Type of the Layout. Supported Layouts are "Global" and "Workspace".

  • "Global"
  • "Activity"
  • "ApplicationDefault"
  • "Swimlane"
  • "Workspace"

  • © 2023 Glue42
  • Home
  • Privacy policy
  • Contact Sales
  • Glue42.com
  • Tick42.com
  • Overview
  • API
  • Layout
  • LayoutSummary
  • NewLayoutOptions
  • RestoreOptions
  • SaveRequestContext
  • SaveRequestResponse
  • ImportMode
  • LayoutType
Navigate
Go