AppManager

5.1.0

The Application Management API provides a way to manage Glue42 Desktop applications. It offers abstractions for:

  • Application - a program as a logical entity, registered in Glue42 Desktop with some metadata (name, description, icon, etc.) and with all the configuration needed to spawn one or more instances of it. The Application Management API provides facilities for retrieving application metadata and for detecting when an application is started.

On how to define and configure an application, see the Configuration section of the documentation.

  • Instance - a running copy of an application. The Application Management API provides facilities for starting/stopping application instances and for managing its windows.

App Management

The Application Management API can be accessed through glue.appManager.

See also the Application Management documentation for more details.

object

Description

Application Management API.

methodready
() => Promise<void | {}>

Description

Notifies when the Application Management API is ready to be used.

Returns

Promise<void | {}>

methodexit
(options: ExitOpts) => Promise<any>

Description

Exits the App Manager, stops all application instances and closes all windows.

Parameters

Name
Type
Required
Description

options

yes

Returns

Promise<any>

methodrestart
(options: ExitOpts) => Promise<any>

Description

Restarts the App Manager, stops all application instances and closes all windows.

Available since version 4.7.0

Parameters

Name
Type
Required
Description

options

yes

Returns

Promise<any>

(name: string) => Application

Description

Returns an application by name.

Parameters

Name
Type
Required
Description

name

string

yes

Name of the desired application.

Returns

Application

() => Application[]

Description

Returns an array with all registered applications for the current branch.

Returns

Application[]

methodinstances
() => Instance[]

Description

Returns an array with all running application instances.

Returns

Instance[]

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when a new application instance has been started.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the started application instance as a parameter.

Returns

UnsubscribeFunction

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when starting a new application instance has failed.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the started application instance as a parameter.

Returns

UnsubscribeFunction

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when an application instance has been stopped.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the stopped application instance as a parameter.

Returns

UnsubscribeFunction

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when an application instance is updated.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the updated application instance as a parameter.

Returns

UnsubscribeFunction

methodonAppAdded
(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when an application is registered in the environment.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the added application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when the application is removed from the environment.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the removed application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when an application is available and can be started.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the available application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when an application is no longer available and cannot be started.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the unavailable application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when the configuration for an application has changed.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the changed application as a parameter.

Returns

UnsubscribeFunction

Properties

Returns the current application instance.

object

Description

Application Management API that allows you to handle your Glue42 enabled applications.

(name: string) => Application

Description

Returns an application by name.

Parameters

Name
Type
Required
Description

name

string

yes

Name of the desired application.

Returns

Application

() => Application[]

Description

Returns an array with all registered applications for the current branch.

Returns

Application[]

methodinstances
() => Instance[]

Description

Returns an array with all running application instances.

Returns

Instance[]

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when a new application instance has been started.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the started application instance as a parameter.

Returns

UnsubscribeFunction

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when starting a new application instance has failed.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the started application instance as a parameter.

Returns

UnsubscribeFunction

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when an application instance has been stopped.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the stopped application instance as a parameter.

Returns

UnsubscribeFunction

(callback: (instance: Instance) => any) => UnsubscribeFunction

Description

Notifies when an application instance is updated.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the updated application instance as a parameter.

Returns

UnsubscribeFunction

methodonAppAdded
(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when an application is registered in the environment.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the added application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when the application is removed from the environment.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the removed application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when an application is available and can be started.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the available application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when an application is no longer available and cannot be started.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the unavailable application as a parameter.

Returns

UnsubscribeFunction

(callback: (app: Application) => any) => UnsubscribeFunction

Description

Notifies when the configuration for an application has changed.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback function to handle the event. Receives the changed application as a parameter.

Returns

UnsubscribeFunction

object

Description

Object describing an application.

methodstart
(context: object, options: ApplicationStartOptions) => Promise<Instance>

Description

Start an instance of the application.

Available since version 3.0.5

Parameters

Name
Type
Required
Description

context

object

no

Context to be passed to the started application.

options

no

Options object in which you can specify window setting (that will override the default configuration settings), as well as other additional options.

Returns

Promise<Instance>

(callback: (instance: Instance) => any) => void

Description

Notifies you when instances of this application are started.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback to handle the event. Receives the instance object as an argument.

Returns

void

(callback: (instance: Instance) => any) => void

Description

Notifies you when instances of this application are stopped.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback to handle the event. Receives the instance object as an argument.

Returns

void

(callback: (app: Application) => any) => void

Description

Notifies you when the application becomes available.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback to handle the event. Receives the application object as an argument.

Returns

void

(callback: (app: Application) => any) => void

Description

Notifies you when the application becomes unavailable.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback to handle the event. Receives the application object as an argument.

Returns

void

methodonChanged
(callback: (app: Application) => any) => void

Description

Notifies you when the application configuration is changed.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback to handle the event. Receives the application object as an argument.

Returns

void

methodonRemoved
(callback: (app: Application) => any) => void

Description

Notifies you when the application is removed.

Parameters

Name
Type
Required
Description

callback

(app: Application) => any

yes

Callback to handle the event. Receives the application object as an argument.

Returns

void

Properties

string

Application name.

string

Application title.

string

Application version.

boolean

If true, the application is auto started with the framework.

Available since version 3.1.0

boolean

Whether the application is a shell application.

Default: false

string

The caption of the application.

Available since version 3.1.0

boolean

Whether the application is present in the Application Manager or not.

Default: false

Available since version 3.1.0

string

The container identifier.

string

The activity type associated with this application (populated only if this is an activity application).

Available since version 3.1.0

string

The activity window type associated with this application (populated only if this is an activity application).

Available since version 3.1.0

The window settings object passed to Glue42 Desktop.

Available since version 3.1.0

boolean

If true, the application can have multiple instances.

Default: true

Available since version 3.1.0

boolean

If true, the application is available and can be started.

string

Base64 string of the app icon.

string

The URL of the app icon.

number

Sort indicator used when ordering apps in a list.

Custom configuration object attached to the application.

boolean

If true, the application is an activity.

Available since version 3.0.8

Glue42 Desktop legacy configuration object for the application. This is kept for legacy applications, all properties are available in the application object now.

Instances of that app.

string

Type of the application.

"html" | "flat" | "tab" | "unknown"

Mode of the application window. If the application is running in a Glue42 window, the possible modes are “flat”, “html” or “tab”. If the mode cannot be determined (e.g., external apps, activity definitions), the value is “unknown”.

object

Description

Generic object for passing properties, settings, etc., in the for of key/value pairs.

object

Description

Object describing an application instance

methodstop
() => Promise<void>

Description

Stops the instance.

Returns

Promise<void>

methodactivate
() => Promise<InvocationResult<any>>

Description

Activates the instance.

Returns

Promise<InvocationResult<any>>

methodonAgmReady
(callback: (instance: Instance) => any) => void

Description

Notifies when the Interop library is ready to be used.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the instance as an argument.

Returns

void

methodonStopped
(callback: (instance: Instance) => any) => void

Description

Notifies when the instance is stopped.

Parameters

Name
Type
Required
Description

callback

(instance: Instance) => any

yes

Callback function to handle the event. Receives the instance as an argument.

Returns

void

Properties

string

Instance ID.

The application object of that instance.

Returns the activity object if the instance is part of an activity.

Returns the instances of the other windows in the activity if this instance is part of an activity.

Available since version 3.0.8

Returns the instance of the owner window of the activity if this instance is part of an activity.

Available since version 3.0.8

The window associated with the instance (as an object from the Window Management API). If the application instance is an activity instance, this is undefined.

Available since version 3.0.8

object

The starting context of the instance.

string

Title of the instance.

boolean

Whether the application instance is an activity instance.

Available since version 3.0.8

string

The activity ID (only if the apps is part of an activity).

Available since version 3.0.8

boolean

If true, the instance is running as part of an activity.

Available since version 3.0.8

boolean

If true, the instance is running as a single window application (not part of an activity).

Available since version 3.0.8

Partial<Instance>

Interop instance. Use this to invoke Interop methods for that instance.

object

Description

Object with options for starting an application.

Properties

boolean

Whether to wait for the Interop library to be initialized.

Default: true

boolean

If true, the application layout will not be saved on close and if a saved layout exists, it will be ignored.

Default: false

number

Distance of the top left window corner from the top edge of the screen.

Default: 0

number

Distance of the top left window corner from the left edge of the screen.

Default: 0

number

Window width.

Default: 400

number

Window height.

Default: 400

boolean

If false, the window will not contain a close button.

Default: true

boolean

If false, the tab header will not contain a close button.

Default: true

boolean

If false, the window will not contain a collapse button.

Default: true

boolean

If false, the window will not contain an activity related forward button.

Default: true

boolean

If false, the window will not contain a maximize button.

Default: true

boolean

If false, the window will not contain a minimize button.

Default: true

boolean

If false, the window will not unstick from other windows.

Default: true

boolean

If false, the window will not contain a lock/unlock button.

Default: false

boolean

If true, when moving the window operation ends, the window will snap to one of the approaching edges of another window (if any of the approaching edges are marked with red).

Default: true

boolean

If true, a snapped window will adjust its bounds to the same width/height of the window it has stuck to, and/or will occupy the space between other windows (if any).

Default: true

string

Image as base64 encoded string that will be used as a taskbar icon for the window. The supported formats are png, ico, jpg, apng.

string

Can be a color name such as “red”, or a hex-encoded RGB or ARGB value.

number

Defines the height of the window when collapsed.

Default: -1

boolean

If true, allows opening a developer console (using F12) for the new window.

Default: true

Object that defines file download behavior in the window.

boolean

If true, the window will start collapsed.

Default: false

boolean

If true, the window will open as a child window, sharing the lifetime and the environment of the opener.

Default: false

boolean

If true, the window will ope n as a child window, sharing the lifetime and the environment of the opener.

Default: false

boolean

If true, the window will stick to other Glue42 Windows forming groups.

Default: true

boolean

If false, the window will not be on focus when created.

Default: true

boolean

If false, the window cannot be moved.

Default: true

boolean

If false, the window cannot be resized by dragging its borders, maximizing, etc.

Default: true

boolean

If true, the window will be started as a hidden window.

Default: false

boolean

If true, this will allow the users to navigate back (CTRL+Left) and forward (CTRL+Right) through the web page history.

Default: true

number

Specifies the maximum window height.

number

Specifies the maximum window width.

number

Specifies the minimum window height.

Default: 30

number

Specifies the minimum window width.

Default: 50

Glue42 Window type. Possible values are flat, tab and html.

Default: "flat"

string

How much of the window area is to be considered as a moving area (meaning you can move the window using it). The string value corresponds to the left, top, right and bottom borders of the window. Setting moveAreaThickness to “0, 20, 0, 0” will set a 20 pixel thick move area at the top of the window.

Default: "0, 12, 0, 0"

string

Margin for the top window move area. The string value corresponds to the left, top, right and bottom borders of the move area. Setting moveAreaTopMargin to “10, 0, 0, 10” will take away 10 pixels from the left and the right side of the move area.

Default: "0, 0, 0, 0"

boolean

If true, the window will appear on top of the z-order.

Default: false

string

The ID of the window that will be used to relatively position the new window. Can be combined with relativeDirection.

Direction ("bottom", "top", "left", "right") of positioning the window relatively to the relativeTo window. Considered only if relativeTo is supplied.

Default: "right"

boolean

If false, the window will not appear on the Windows taskbar.

Default: true

boolean

Determines whether the window will have a title bar.

Default: true

string

How much of the window area is to be considered as a sizing area (meaning you can resize the window using that area). The string value corresponds to the left, top, right and bottom borders.

Default: "5, 5, 5, 5"

string

Specifies the active Glue42 Window snapping edges. Possible values are: top, left, right, bottom, all or any combination of them (e.g., left, right).

Default: "all"

string

Specifies the start window location. Possible options are Automatic (The Glue42 Window decides where the window will be positioned) and CenterScreen.

string

Specifies the Glue42 window frame color. Accepts hex color as string (e.g. "#666666") or named HTML colors (e.g. "red").

Default: "#5b8dc9"

string

If set, the Glue42 Window can only stick to windows that have the same group.

Default: "Any"

string

Specifies the tab group ID. If two or more tab windows are defined with the same ID, they will be hosted in the same tab window.

number

Specifies the tab position index. Tab windows in the same tab group are ordered by their position index. Use negative index to make the tab active.

boolean

Tab is selected.

Default: true

string

The tab title.

Default: ""

string

The tab tooltip.

Default: ""

string

Sets the window title. To work properly, there should be a title HTML tag in the page.

Object that defines loader behavior.

boolean

If true, this will set a random (from a predefined list of colors) frame color to the new window.

Default: false

If set, the window will start in the specified state (maximized, minimized, normal).

Default: "normal"

object

Description

Legacy application configuration options.

Properties

boolean

Whether to auto start the application.

string

Caption for the application.

boolean

string

Container identifier.

string

Activity type (if the application is in an activity).

boolean

If true, multiple instances of the app can be started.