Class: LauncherClient

Launcher Client

The Launcher client handles spawning windows. It also maintains the list of spawnable components.

The following topics can be subscribed to:

"monitorInfo" - publishes a monitorInfo array such as is returned from LauncherClient#getMonitorInfoAll. This includes "unclaimedRect" entries for each monitor. An event will be published whenever monitor configuration changes. This includes when a new component is added that makes a claim on monitor space (i.e. a toolbar)

Methods

getActiveDescriptors
(cb)

clients/launcherClient.js, line 413

Gets the LauncherClient~windowDescriptor for all open windows.

Note: This returns descriptors even if the window is not part of the workspace.

Name Type Description
cb function

Callback returns an array of windowDescriptors

getComponentDefaultConfig
(componentType, cb)

clients/launcherClient.js, line 91

Get the component config (i.e. from components.json) for a specific component.

Name Type Description
componentType String

The type of the component.

cb function

Callback returns the default config (windowDescriptor) for the requested componentType.

getComponentList
(cb)

clients/launcherClient.js, line 75

Get a list of registered components (those that were entered into components.json).

Name Type Description
cb function

Callback returns an object map of components. Each component object contains the default config for that component.

getMonitorInfo
(params, cb)

clients/launcherClient.js, line 128

Gets monitorInfo (dimensions and position) for a given windowIdentifier or for a specific monitor. If neither the identifier or monitor are provided then the monitorInfo for the current window is returned.

The information returned contains a supplemented OpenFin monitor descriptor which contains:

monitorRect - The full dimensions for the monitor from OpenFin.

availableRect - The dimensions for the available space on the monitor (less windows toolbars).

unclaimedRect - The dimensions for available monitor space less any space claimed by components (such as the application Toolbar).

Each of these is supplemented with the following additional members:

width - The width as calculated (right - left).

height - The height as calculated (bottom - top).

position - The position of the monitor, numerically from zero to X. Primary monitor is zero.

whichMonitor - Contains the string "primary" if it is the primary monitor.

Name Type Description
params object optional

Parameters

Name Type Description
windowIdentifier LauncherClient~windowIdentifier optional

The windowIdentifier to get the monitorInfo. If undefined, then the current window.

monitor any optional

If passed then a specific monitor is identified. Valid values are the same as for LauncherClient#spawn.

cb function

Returns a monitorInfo object containing the monitorRect, availableRect and unclaimedRect.

getMonitorInfoAll
(cb)

clients/launcherClient.js, line 148

Gets monitorInfo (dimensions and position) for all monitors. Returns an array of monitorInfo objects. See LauncherClient#getMonitorInfo for the format of a monitorInfo object.

Name Type Description
cb function

Returns an array of monitorInfo objects.

getMyWindowIdentifier
(cb){Promise}

clients/launcherClient.js, line 401

Returns a LauncherClient~windowIdentifier for the current window

Name Type Description
cb LauncherClient~windowIdentifier

Callback function returns windowIdentifier for this window (optional or use the returned Promise)

Returns:
Type Description
Promise A promise that resolves to a windowIdentifier

getRawWindow

clients/launcherClient.js, line 332

Returns an object that provides raw access to a remote window. It returns an object that contains references to the Finsemble windowDescriptor, to the OpenFin window, and to the native JavaScript (browser) window.

This will only work for windows that are launched using the Finsemble Launcher API.

As in any browser, you will not be able to manipulate a window that has been launched cross domain or in a separate physical OpenFin application (separate process). Caution should be taken to prevent a window from being closed by the user if you plan on referencing it directly. Due to these inherent limitations we strongly advise against a paradigm of directly manipulating remote windows through JavaScript. Instead leverage the RouterClient to communicate between windows and to use an event based paradigm!

Name Type Description
params object

Parameters

Name Type Description
windowName string

The name of the window to access.

Returns:
Type Description
LauncherClient~rawWindowResult An object containing windowDescriptor, finWindow, and browserWindow. Or null if window isn't found.

showWindow
(windowIdentifier, params, cb)

clients/launcherClient.js, line 173

Displays a window and relocates/resizes it according to the values contained in params.

Name Type Description
windowIdentifier LauncherClient~windowIdentifier

A windowIdentifier.

params object

Parameters. These are the same as RouterClient#spawn with the folowing exceptions:

Name Type Default Description
monitor any optional

Same as spawn() except that null or undefined means the window should not be moved to a different monitor.

left any optional

Same as spawn() except that null or undefined means the window should not be moved from current horizontal location.

top any optional

Same as spawn() except that null or undefined means the window should not be moved from current vertical location.

spawnIfNotFound boolean false optional

If true, then spawns a new window if the requested one cannot be found. Note, only works if the windowIdentifier contains a componentType.

slave boolean optional

Cannot be set for an existing window. Will only go into effect if the window is spawned. (In other words, only use this in conjunction with spawnIfNotFound).

cb function

Callback to be invoked after function is completed. Callback contains an object with the following information: windowIdentifier - The LauncherClient~windowIdentifier for the new window. windowDescriptor - The LauncherClient~windowDescriptor of the new window. finWindow - An OpenFin window referencing the new window.

spawn
(component, params, cb)

clients/launcherClient.js, line 291

Asks the Launcher service to spawn a new component. Any parameter below can also be specified in config/components.json, which will then operate as the default for that value.

The launcher parameters mimic CSS window positioning. For instance, to set a full size window use left=0,top=0,right=0,bottom=0. This is functionally equivalent to: left=0,top=0,width="100%",height="100%"

Name Type Description
component String

Type of the component to launch. If null or undefined, then params.url will be used instead.

params object
Name Type Default Description
monitor any "mine" optional

Which monitor to place the new window. "mine" - Place the window on the same monitor as the calling window. A numeric value of monitor (where primary is zero). "primary","next" and "previous" indicate a specific monitor. "all" - Put a copy of the component on all monitors

position string unclaimed optional

Defines a "viewport" for the spawn, with one of the following values:

"unclaimed" (the default) Positioned based on the monitor space excluding space "claimed" by other components (such as toolbars). For instance, top:0 will place the new component directly below the toolbar.

"available" Positioned according to the coordinates available on the monitor itself, less space claimed by the operating system (such as the windows toolbar). For instance, bottom:0 will place the new component with its bottom flush against the windows toolbar.

"monitor" Positioned according to the absolute size of the monitor. For instance, top:0 will place the component overlapping the toolbar.

"relative" Positioned relative to the relativeWindow. For instance, left:0;top:0 will joing the top left corner of the new component with the top left corner of the relative window.

"virtual" Positoned against coordinates on the virtual screen. The virtual screen is the full viewing area of all monitors combined into a single theoretical monitor.

groupOnSpawn boolean false optional

If true, will group with a window. **Only valid if params.position=== 'relative'.

left any optional

A pixel value representing the distance from the left edge of the viewport as defined by "position". A percentage value may also be used, representing the percentage distance from the left edge of the viewport relative to the viewport's width.

"adjacent" will snap to the right edge of the spawning or relative window.

"center" will center the window

If neither left nor right are provided, then the default will be to stagger the window based on the last spawned window. Note - the staggering algorithm has a timing element that is optimized based on user testing.

top any optional

Same as left except related to the top of the viewport.

right any optional

Same as left except releated to the right of the viewport.

bottom any optional

Same as left except related to the bottom of the viewport.

height any optional

A pixel or percentage value.

width any optional

A pixel value or percentage value.

ephemeral boolean false optional

Indicates that this window is ephemeral. An ephemeral window is a dialog, menu or other window that is temporarily displayed but usually hidden. Ephemeral windows automatically have the following OpenFin settings assigned: resizable: false, showTaskbarIcon: false, alwaysOnTop: true. Note, use options:{autoShow: false} to prevent an ephemeral widow from showing automatically.

staggerPixels number 100 optional

Number of pixels to stagger (default when neither left, right, top or bottom are set).

claimMonitorSpace boolean optional

For use with permanent toolbars. The available space for other components will be reduced by the amount of space covered by the newly spawned component. This will be reflected in the unclaimedRect member from API calls that return monitorInfo. Users will be prevented from moving windows to a position that covers the claimed space. See position: 'unclaimed'.

relativeWindow LauncherClient~windowIdentifier current window optional

The window to use when calculating any relative launches. If not set then the window from which spawn() was called.

slave boolean optional

If true then the new window will act as a slave to the relativeWindow (or the launching window if relativeWindow is not specified). Slave windows will automatically close when their parent windows close.

url string optional

Optional url to launch. Overrides what is passed in "component".

native string optional

Optional native application to launch with Assimilation service. Overrides what is passed in "component".

name string optional

Optional window name. If not provided, then a random name will be assigned to the newly created OpenFin window.

data any optional

Optional data to pass to the opening window. If set, then the spawned window can use WindowClient#getSpawnData to retrieve the data.

options LauncherClient~windowDescriptor optional

Properties to merge with the default windowDescriptor. Any value set here will be sent directly to the OpenFin window, and will override the effect of relevant parameters to spawn(). See http://cdn.openfin.co/jsdocs/stable/fin.desktop.Window.html#~options for the full set and defaults, with the following exception:

Name Type Default Description
frame boolean false optional

By default, all Finsemble windows are frameless

addToWorkspace boolean false optional

Whether to add the new component to the workspace. Even when true, the window will still not be added to the workspace if addToWorkspace==false in components.json config for the component type.

cb function optional

Callback to be invoked after function is completed. Callback contains an object with the following information: windowIdentifier - The {@LauncherClient~windowIdentifier} for the new component. windowDescriptor - The {@LauncherClient~windowDescriptor} for the new window. finWindow - An OpenFin window object that contains the spawned component.

Type Definitions

rawWindowResultobject

A convenient assembly of native JavaScript window, OpenFin window and windowDescriptor.

Properties:
Name Type Description
windowDescriptor LauncherClient~windowDescriptor

The window descriptor.

finWindow Fin.Desktop.Window

The OpenFin window.

browserWindow Window

The native JavaScript window.

windowDescriptorobject

Finsemble windowDescriptor. This is a superset of the Openfin windowOptions object. In addition to the values provided by OpenFin, the windowDescriptor includes the following values.

Properties:
Name Type Argument Description
url string <optional>

url to load (if HTML5 component).

native string <optional>

The name of the native app (if a native component launched by Assimilation service).

name string

The name of the window (sometimes randomly assigned).

componentType string

The type of component (from components.json).

windowIdentifier

An object that includes all the potential identifications for a window. For instance, one can try and obtain a reference for a window if some of these values are known.

Properties:
Name Type Argument Description
windowName string <optional>

The name of the physical OpenFin window, or a reference to a native window that was launched with Assimilation service

uuid string <optional>

Optional uuid of a particular OpenFin application process

componentType string <optional>

The type of component

monitor number <optional>

The number of the monitor. Potentially used to disambiguate multiple components with the same name (for searches only)