Class: Application

Application

An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events.

Methods

(static) getCurrent() → {Promise.<Application>}

Asynchronously returns an Application object that represents the current application

Tutorials:
Returns:
Type
Promise.<Application>

(static) getCurrentSync() → {Application}

Synchronously returns an Application object that represents the current application

Tutorials:
Returns:
Type
Application

(async, static) start(appOptions) → {Promise.<Application>}

Creates and starts a new Application.

Parameters:
Name Type Description
appOptions ApplicationOption
Tutorials:
Returns:
Type
Promise.<Application>

(async, static) startFromManifest(manifestUrl) → {Promise.<Application>}

Retrieves application's manifest and returns a running instance of the application.

Parameters:
Name Type Description
manifestUrl string

The URL of app's manifest.

Tutorials:
Returns:
Type
Promise.<Application>

(static) wrap(identity) → {Promise.<Application>}

Asynchronously returns an Application object that represents an existing application.

Parameters:
Name Type Description
identity Identity
Tutorials:
Returns:
Type
Promise.<Application>

(static) wrapSync(identity) → {Application}

Synchronously returns an Application object that represents an existing application.

Parameters:
Name Type Description
identity Identity
Tutorials:
Returns:
Type
Application

addListener(eventType, listener, optionsopt) → {Promise.<this>}

Adds a listener to the end of the listeners array for the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

Called whenever an event of the specified type occurs.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

getChildWindows() → {Promise.Array.<_Window>}

Retrieves an array of wrapped fin.Windows for each of the application’s child windows.

Tutorials:
Returns:
Type
Promise.Array.<_Window>

getGroups() → {Promise.Array.Array.<_Window>}

Retrieves an array of active window groups for all of the application's windows. Each group is represented as an array of wrapped fin.Windows.

Tutorials:
Returns:
Type
Promise.Array.Array.<_Window>

getInfo() → {Promise.<ApplicationInfo>}

Retrieves information about the application.

Tutorials:
Returns:
Type
Promise.<ApplicationInfo>

getManifest() → {Promise.<any>}

Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest.

Tutorials:
Returns:
Type
Promise.<any>

getParentUuid() → {Promise.<string>}

Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest.

Tutorials:
Returns:
Type
Promise.<string>

getShortcuts() → {Promise.<ShortCutConfig>}

Retrieves current application's shortcut configuration.

Tutorials:
Returns:
Type
Promise.<ShortCutConfig>

getTrayIconInfo() → {Promise.<TrayInfo>}

Retrieves information about the system tray.

The only information currently returned is the position and dimensions.

Tutorials:
Returns:
Type
Promise.<TrayInfo>

getWindow() → {Promise.<_Window>}

Returns an instance of the main Window of the application

Tutorials:
Returns:
Type
Promise.<_Window>

getZoomLevel() → {Promise.<number>}

Returns the current zoom level of the application.

Tutorials:
Returns:
Type
Promise.<number>

isRunning() → {Promise.<boolean>}

Determines if the application is currently running.

Tutorials:
Returns:
Type
Promise.<boolean>

on(eventType, listener, optionsopt) → {Promise.<this>}

Adds a listener to the end of the listeners array for the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

Called whenever an event of the specified type occurs.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

once(eventType, listener, optionsopt) → {Promise.<this>}

Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

prependListener(eventType, listener, optionsopt) → {Promise.<this>}

Adds a listener to the beginning of the listeners array for the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

prependOnceListener(eventType, listener, optionsopt) → {Promise.<this>}

Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

(async) quit(forceopt) → {Promise.<boolean>}

Closes the application and any child windows created by the application. Cleans the application from state so it is no longer found in getAllApplications.

Parameters:
Name Type Attributes Default Description
force boolean <optional>
false

Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.

Tutorials:
Returns:
Type
Promise.<boolean>

registerUser(userName, appName) → {Promise.<void>}

Manually registers a user with the licensing service. The only data sent by this call is userName and appName.

Parameters:
Name Type Description
userName string

username to be passed to the RVM.

appName string

app name to be passed to the RVM.

Tutorials:
Returns:
Type
Promise.<void>

removeAllListeners(eventTypeopt) → {Promise.<this>}

Removes all listeners, or those of the specified event.

Parameters:
Name Type Attributes Description
eventType string | symbol <optional>

The type of the event.

Tutorials:
Returns:
Type
Promise.<this>

removeListener(eventType, listener, optionsopt) → {Promise.<this>}

Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.

Parameters:
Name Type Attributes Description
eventType string | symbol

The type of the event.

listener function

The callback function.

options SubOptions <optional>

Option to support event timestamps.

Tutorials:
Returns:
Type
Promise.<this>

removeTrayIcon() → {Promise.<void>}

Removes the application’s icon from the tray.

Tutorials:
Returns:
Type
Promise.<void>

restart() → {Promise.<void>}

Restarts the application.

Tutorials:
Returns:
Type
Promise.<void>

scheduleRestart() → {Promise.<void>}

Instructs the RVM to schedule one restart of the application.

Tutorials:
Returns:
Type
Promise.<void>

(async) sendApplicationLog() → {Promise.<any>}

Sends a message to the RVM to upload the application's logs. On success, an object containing logId is returned.

Tutorials:
Returns:
Type
Promise.<any>

(async) setAppLogUsername(username) → {Promise.<void>}

Sets a username to correlate with App Log Management.

Parameters:
Name Type Description
username string

Username to correlate with App's Log.

Tutorials:
Returns:
Type
Promise.<void>

setShortcuts(config) → {Promise.<void>}

Sets new application's shortcut configuration.

Parameters:
Name Type Description
config ShortCutConfig

New application's shortcut configuration.

Properties
Name Type Attributes Description
desktop boolean <optional>

Enable/disable desktop shortcut.

startMenu boolean <optional>

Enable/disable start menu shortcut.

systemStartup boolean <optional>

Enable/disable system startup shortcut.

Tutorials:
Returns:
Type
Promise.<void>

setTrayIcon(iconUrl) → {Promise.<void>}

Adds a customizable icon in the system tray. To listen for a click on the icon use the tray-icon-clicked event.

Parameters:
Name Type Description
iconUrl string

Image URL to be used as the icon

Tutorials:
Returns:
Type
Promise.<void>

setZoomLevel(level) → {Promise.<void>}

Sets the zoom level of the application. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.

Parameters:
Name Type Description
level number

The zoom level

Tutorials:
Returns:
Type
Promise.<void>

terminate() → {Promise.<void>}

Closes the application by terminating its process.

Tutorials:
Returns:
Type
Promise.<void>

Type Definitions

options

Application creation options.

This is the options object required by Application.create.

The following options are required:

  • uuid is required in the app manifest as well as by Application.create
  • name is optional in the app manifest but required by Application.create
  • url is optional in both the app manifest Application.create and but is usually given (defaults to "about:blank" when omitted).

This jsdoc typedef mirrors the ApplicationOptions TypeScript interface in @types/openfin.

IMPORTANT NOTE: This object inherits all the properties of the window creation options object, which will take priority over those of the same name that may be provided in mainWindowOptions.

Type:
  • object
Properties:
Name Type Attributes Default Description
disableIabSecureLogging boolean <optional>
false

When set to true it will disable IAB secure logging for the app.

loadErrorMessage string <optional>
"There was an error loading the application."

An error message to display when the application (launched via manifest) fails to load. A dialog box will be launched with the error message just before the runtime exits. Load fails such as failed DNS resolutions or aborted connections as well as cancellations, e.g., window.stop(), will trigger this dialog. Client response codes such as 404 Not Found are not treated as fails as they are valid server responses.

mainWindowOptions Window~options <optional>

The options of the main window of the application. For a description of these options, click the link (in the Type column).

name string <optional>

The name of the application (and the application's main window).

If provided, must match uuid.

nonPersistent boolean <optional>
false

A flag to configure the application as non-persistent. Runtime exits when there are no persistent apps running.

plugins boolean <optional>
false

Enable Flash at the application level.

spellCheck boolean <optional>
false

Enable spell check at the application level.

url string <optional>
"about:blank"

The url to the application (specifically the application's main window).

uuid string

The Unique Universal Identifier (UUID) of the application, unique within the set of all other applications running in the OpenFin Runtime.

Note that name and uuid must match.

webSecurity boolean <optional>
true

When set to false it will disable the same-origin policy for the app.