Class: Application

Application

Constructor

new Application(options, callbackopt, errorCallbackopt)

Creates a new Application.

Must be invoked with the new keyword. (See application.constructor tutorial for an example.) Alternatively, you may call fin.desktop.Application.wrap which essentially does this for you.

Parameters:
Name Type Attributes Description
options fin.desktop.Application~options

Application creation options. See options for more details.

callback errorCallback <optional>

Callback on success

errorCallback successCallback <optional>

Callback on error

Tutorials:
To Do:
  • Make sure any edits to this Table of Contents are also made to docs home page (/docs-README.md)!!

Methods

(static) getCurrent() → {fin.desktop.Application|fin.desktop.Application}

Returns an instance of the currently running application.

Tutorials:
Returns:

(static) wrap(uuid) → {fin.desktop.Application}

Returns an Application object that represents an existing application.

Parameters:
Name Type Description
uuid string

The UUID of the application to be wrapped.

Tutorials:
Returns:
  • fin.desktop.Application Object.
Type
fin.desktop.Application

addEventListener(type, listener, callbackopt, errorCallbackopt)

Registers an event listener on the specified event.

Parameters:
Name Type Attributes Description
type string

The type of the event.

listener function

Called whenever an event of the specified type occurs. It is passed an event object containing information related to the event.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

close(forceopt, callbackopt, errorCallbackopt)

Closes the application and any child windows created by the application.

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.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getChildWindows(callbackopt, errorCallbackopt)

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

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getGroups(callbackopt, errorCallbackopt)

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

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getInfo(callbackopt, errorCallbackopt)

Retrieves information about the application.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getManifest(callbackopt, errorCallbackopt)

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

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getParentUuid(callbackopt, errorCallbackopt)

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

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getShortcuts(callbackopt, errorCallbackopt)

Retrieves current application's shortcut configuration.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getTrayIconInfo(callbackopt, errorCallbackopt)

Retrieves information about the system tray.

The only information currently returned is the position and dimensions.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

getWindow() → {fin.desktop.Window}

Returns an instance of the main Window of the application

Tutorials:
Returns:

window - fin.desktop.Window

Type
fin.desktop.Window

isRunning(callbackopt, errorCallbackopt)

Determines if the application is currently running.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

registerCustomData(data, callbackopt, errorCallbackopt)

Passes in custom data that will be relayed to the RVM

Parameters:
Name Type Attributes Description
data Object

Data to be passed to the RVM.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

removeEventListener(type, listener, callbackopt, errorCallbackopt)

Removes a previously registered event listener from the specified event.

Parameters:
Name Type Attributes Description
type string

The type of the event.

listener function

Called whenever an event of the specified type occurs. It is passed an event object containing information related to the event.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

removeTrayIcon(callbackopt, errorCallbackopt)

Removes the application’s icon from the tray.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

restart(callbackopt, errorCallbackopt)

Restarts the application.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

run(callbackopt, errorCallbackopt)

Runs the application. When the application is created, run must be called.

Parameters:
Name Type Attributes Description
callback successCallback <optional>

called if the method succeeds. See success callback for shape.

errorCallback errorCallback <optional>

called if there is a network error. See error callback for shape.

Tutorials:

scheduleRestart(callbackopt, errorCallbackopt)

Instructs the RVM to schedule one restart of the application.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

setShortcuts(config, callbackopt, errorCallbackopt)

Sets new application's shortcut configuration.

Parameters:
Name Type Attributes Description
config Object

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.

callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

setTrayIcon(iconUrl, listeners, callbackopt, errorCallbackopt)

Adds a customizable icon in the system tray and notifies the application when clicked.

Parameters:
Name Type Attributes Description
iconUrl string

Image URL to be used as the icon.

listeners trayIconClickEventListener | object

Hash of tray icon listeners. If you only need a click listener, you may provide it here as a shortcut.

listeners.clickListener trayIconClickEventListener <optional>
listeners.hoverListener trayIconHoverEventListener <optional>
callback function <optional>

Called if the method succeeds.

errorCallback function <optional>

Called if the method fails. The reason for failure is passed as an argument.

Tutorials:

terminate(callbackopt, errorCallbackopt)

Closes the application by terminating its process.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

wait(callbackopt, errorCallbackopt)

Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application to continue and to generate another "not-responding" message after a certain period of time.

Parameters:
Name Type Attributes Description
callback function <optional>

called if the method succeeds.

errorCallback function <optional>

called if the method fails. The reason for failure is passed as an argument.

Tutorials:

Type Definitions

options

Application creation options.

This is the options object required by the Application constructor.

Type:
  • object
Properties:
Name Type Attributes Default Description
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 fin.desktop.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

The name of the application. Note that name and uuid must match.

plugins boolean <optional>
false

Enable Flash at the application level.

url string <optional>
'about:blank'

The url to the application.

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.