Tutorial: application.constructor

application.constructor

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

Syntax

fin.desktop.Application(object options,
                        function callback,
                        function errorCallback);

Parameters

object options

The options of the application. See below.

function callback()

Optional. A function that is called when the Application object is ready to use.

function errorCallback(string reason)

Optional. A function that is called if the constructor fails. The reason for failure is passed as an argument.

Options

Required

string applicationIcon

The URL of an icon to be shown on the desktop. Support formats: Portable Network Graphic (PNG); Size: 256 x 256

string name

The name of the application.

string uuid

The UUID of the application, unique within the set of all other Applications running in OpenFin Runtime.

Optional

object mainWindowOptions
    The options of the main window of the application. For a description of these options, see
    <a href="/developers/api/js/window/window.html">Window</a>.
string version

The version of the application.

Full arguments for mainWindowOptions can be found here under startup_app config

Example

var app = new fin.desktop.Application({
    url: "application.html",
    uuid: "74BED629-2D8E-4141-8582-73E364BDFA74",
    applicationIcon: "icon.png",
    name: "Application Name",
    mainWindowOptions: {
        defaultHeight: 600,
        defaultWidth: 800,
        defaultTop: 300,
        defaultLeft: 300,
        autoShow: true
    }
}, function () {
    console.log("Application successfully created");
    app.run();
}, function () {
    console.log("Error creating application");
});