AboutSupportDeveloper GuideVersion 34.118.78.83

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

Hierarchy

Properties

Accessors

  • get me(): Identity
  • Provides access to the OpenFin representation of the current code context (usually a document such as a View or Window), as well as to the current Interop context.

    Useful for debugging in the devtools console, where this will intelligently type itself based on the context in which the devtools panel was opened.

    Returns Identity

Methods

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

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Parameters

    Returns Promise<Application>

  • Parameters

    • force: boolean = false

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

    Returns Promise<void>

    Deprecated

    use Application.quit instead Closes the application and any child windows created by the application.

    Example

    async function closeApp() {
    const app = await fin.Application.getCurrent();
    return await app.close();
    }
    closeApp().then(() => console.log('Application closed')).catch(err => console.log(err));
  • Returns (string | symbol)[]

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

    Returns Promise<Window[]>

    Example

    async function getChildWindows() {
    const app = await fin.Application.getCurrent();
    return await app.getChildWindows();
    }

    getChildWindows().then(children => console.log(children)).catch(err => console.log(err));
  • Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.

    Note: This method is restricted by default and must be enabled via API security settings.

    Returns Promise<string>

    Throws

    if getting file auto download location on different applications.

    Example

    const app = await fin.Application.getCurrent();
    const fileDownloadDir = await app.getFileDownloadLocation();
  • Retrieves information about the application.

    Returns Promise<ApplicationInfo>

    Remarks

    If the application was not launched from a manifest, the call will return the closest parent application manifest and manifestUrl. initialOptions shows the parameters used when launched programmatically, or the startup_app options if launched from manifest. The parentUuid will be the uuid of the immediate parent (if applicable).

    Example

    async function getInfo() {
    const app = await fin.Application.getCurrent();
    return await app.getInfo();
    }

    getInfo().then(info => console.log(info)).catch(err => console.log(err));
  • Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest.

    Returns Promise<Manifest>

    Example

    async function getManifest() {
    const app = await fin.Application.getCurrent();
    return await app.getManifest();
    }

    getManifest().then(manifest => console.log(manifest)).catch(err => console.log(err));
  • Retrieves UUID of the application that launches this application. Invokes the error callback if the application was created from a manifest.

    Returns Promise<string>

    Example

    async function getParentUuid() {
    const app = await fin.Application.start({
    uuid: 'app-1',
    name: 'myApp',
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getParentUuid.html',
    autoShow: true
    });
    return await app.getParentUuid();
    }

    getParentUuid().then(parentUuid => console.log(parentUuid)).catch(err => console.log(err));
  • Experimental

    Retrieves all process information for entities (windows and views) associated with an application.

    Returns Promise<AppProcessInfo>

    Example

        const app = await fin.Application.getCurrent();
    const processInfo = await app.getProcessInfo();
  • Retrieves current application's shortcut configuration.

    Returns Promise<ShortCutConfig>

    Example

    async function getShortcuts() {
    const app = await fin.Application.wrap({ uuid: 'testapp' });
    return await app.getShortcuts();
    }
    getShortcuts().then(config => console.log(config)).catch(err => console.log(err));
  • Retrieves information about the system tray. If the system tray is not set, it will throw an error message.

    Returns Promise<TrayInfo>

    Remarks

    The only information currently returned is the position and dimensions.

    Example

    async function getTrayIconInfo() {
    const app = await fin.Application.wrap({ uuid: 'testapp' });
    return await app.getTrayIconInfo();
    }
    getTrayIconInfo().then(info => console.log(info)).catch(err => console.log(err));
  • Experimental

    Retrieves current application's views.

    Returns Promise<View[]>

    Example

    async function getViews() {
    const app = await fin.Application.getCurrent();
    return await app.getViews();
    }
    getViews().then(views => console.log(views)).catch(err => console.log(err));
  • Returns an instance of the main Window of the application

    Returns Promise<Window>

    Example

    async function getWindow() {
    const app = await fin.Application.start({
    uuid: 'app-1',
    name: 'myApp',
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Application.getWindow.html',
    autoShow: true
    });
    return await app.getWindow();
    }

    getWindow().then(win => {
    win.showAt(0, 400);
    win.flash();
    }).catch(err => console.log(err));
  • Returns the current zoom level of the application.

    Returns Promise<number>

    Example

    async function getZoomLevel() {
    const app = await fin.Application.getCurrent();
    return await app.getZoomLevel();
    }

    getZoomLevel().then(zoomLevel => console.log(zoomLevel)).catch(err => console.log(err));
  • Checks if the application has an associated tray icon.

    Returns Promise<boolean>

    Example

    const app = await fin.Application.wrap({ uuid: 'testapp' });
    const hasTrayIcon = await app.hasTrayIcon();
    console.log(hasTrayIcon);
  • Determines if the application is currently running.

    Returns Promise<boolean>

    Example

    async function isAppRunning() {
    const app = await fin.Application.getCurrent();
    return await app.isRunning();
    }
    isAppRunning().then(running => console.log(`Current app is running: ${running}`)).catch(err => console.log(err));
  • Parameters

    • type: string | symbol

    Returns number

  • Parameters

    • type: string | symbol

    Returns Function[]

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

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Parameters

    Returns Promise<Application>

    Remarks

    Event payloads are documented in the Events namespace.

  • 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.

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Parameters

    Returns Promise<Application>

    Remarks

    Event payloads are documented in the Events namespace.

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

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Parameters

    Returns Promise<Application>

    Remarks

    Event payloads are documented in the Events namespace.

  • 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.

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Parameters

    Returns Promise<Application>

    Remarks

    Event payloads are documented in the Events namespace.

  • 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

    • force: boolean = false

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

    Returns Promise<void>

    Example

    async function closeApp() {
    const allApps1 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}, {uuid: 'app2', isRunning: true}]
    const app = await fin.Application.wrap({uuid: 'app2'});
    await app.quit();
    const allApps2 = await fin.System.getAllApplications(); //[{uuid: 'app1', isRunning: true}]

    }
    closeApp().then(() => console.log('Application quit')).catch(err => console.log(err));
  • Manually registers a user with the licensing service. The only data sent by this call is userName and appName.

    Parameters

    • userName: string

      username to be passed to the RVM.

    • appName: string

      app name to be passed to the RVM.

    Returns Promise<void>

    Example

    async function registerUser() {
    const app = await fin.Application.getCurrent();
    return await app.registerUser('user', 'myApp');
    }

    registerUser().then(() => console.log('Successfully registered the user')).catch(err => console.log(err));
  • Removes all listeners, or those of the specified event.

    Parameters

    • Optional eventType: "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Returns Promise<Application>

  • Remove a listener from the listener array for the specified event.

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "view-blurred" | "view-certificate-selection-shown" | "view-crashed" | "view-did-change-theme-color" | "view-focused" | "view-navigation-rejected" | "view-url-changed" | "view-did-fail-load" | "view-did-finish-load" | "view-page-favicon-updated" | "view-page-title-updated" | "view-resource-load-failed" | "view-resource-response-received" | "view-child-content-blocked" | "view-child-content-opened-in-browser" | "view-child-view-created" | "view-child-window-created" | "view-file-download-started" | "view-file-download-progress" | "view-file-download-completed" | "view-found-in-page" | "view-certificate-error" | "view-created" | "view-destroyed" | "view-hidden" | "view-hotkey" | "view-shown" | "view-target-changed" | "view-host-context-changed" | "connected" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "window-blurred" | "window-certificate-selection-shown" | "window-crashed" | "window-did-change-theme-color" | "window-focused" | "window-navigation-rejected" | "window-url-changed" | "window-did-fail-load" | "window-did-finish-load" | "window-page-favicon-updated" | "window-page-title-updated" | "window-resource-load-failed" | "window-resource-response-received" | "window-child-content-blocked" | "window-child-content-opened-in-browser" | "window-child-view-created" | "window-child-window-created" | "window-file-download-started" | "window-file-download-progress" | "window-file-download-completed" | "window-found-in-page" | "window-certificate-error" | "window-view-attached" | "window-view-detached" | "window-auth-requested" | "window-begin-user-bounds-changing" | "window-bounds-changed" | "window-bounds-changing" | "window-context-changed" | "window-closed" | "window-closing" | "window-disabled-movement-bounds-changed" | "window-disabled-movement-bounds-changing" | "window-embedded" | "window-end-user-bounds-changing" | "window-external-process-exited" | "window-external-process-started" | "window-hidden" | "window-hotkey" | "window-initialized" | "window-layout-initialized" | "window-layout-ready" | "window-maximized" | "window-minimized" | "window-options-changed" | "window-performance-report" | "window-preload-scripts-state-changed" | "window-preload-scripts-state-changing" | "window-reloaded" | "window-restored" | "window-show-requested" | "window-shown" | "window-user-movement-disabled" | "window-user-movement-enabled" | "window-will-move" | "window-will-redirect" | "window-will-resize" | "window-show-all-downloads" | "window-download-shelf-visibility-changed"

    Parameters

    Returns Promise<Application>

    Remarks

    Caution: Calling this method changes the array indices in the listener array behind the listener.

  • Removes the application’s icon from the tray.

    Returns Promise<void>

    Example

    async function removeTrayIcon() {
    const app = await fin.Application.getCurrent();
    return await app.removeTrayIcon();
    }

    removeTrayIcon().then(() => console.log('Removed the tray icon.')).catch(err => console.log(err));
  • Restarts the application.

    Returns Promise<void>

    Example

    async function restartApp() {
    const app = await fin.Application.getCurrent();
    return await app.restart();
    }
    restartApp().then(() => console.log('Application restarted')).catch(err => console.log(err));
  • Instructs the RVM to schedule one restart of the application.

    Returns Promise<void>

    Example

    async function scheduleRestart() {
    const app = await fin.Application.getCurrent();
    return await app.scheduleRestart();
    }

    scheduleRestart().then(() => console.log('Application is scheduled to restart')).catch(err => console.log(err));
  • Sends a message to the RVM to upload the application's logs. On success, an object containing logId is returned.

    Returns Promise<SendApplicationLogResponse>

    Example

    async function sendLog() {
    const app = await fin.Application.getCurrent();
    return await app.sendApplicationLog();
    }

    sendLog().then(info => console.log(info.logId)).catch(err => console.log(err));
  • Sets a username to correlate with App Log Management.

    Parameters

    • username: string

      Username to correlate with App's Log.

    Returns Promise<void>

    Example

    async function setAppLogUser() {
    const app = await fin.Application.getCurrent();
    return await app.setAppLogUsername('username');
    }

    setAppLogUser().then(() => console.log('Success')).catch(err => console.log(err));
  • Sets file auto download location. It's only allowed in the same application.

    Note: This method is restricted by default and must be enabled via API security settings.

    Parameters

    • downloadLocation: string

      file auto download location

    Returns Promise<void>

    Throws

    if setting file auto download location on different applications.

    Example

    const downloadLocation = 'C:\\dev\\temp';
    const app = await fin.Application.getCurrent();
    try {
    await app.setFileDownloadLocation(downloadLocation);
    console.log('File download location is set');
    } catch(err) {
    console.error(err)
    }
  • Sets or removes a custom JumpList for the application. Only applicable in Windows OS. If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).

    Note: If the "name" property is omitted it defaults to "tasks".

    Parameters

    • jumpListCategories: null | JumpListCategory[]

      An array of JumpList Categories to populate. If null, remove any existing JumpList configuration and set to Windows default.

    Returns Promise<void>

    Remarks

    If categories is null the previously set custom JumpList (if any) will be replaced by the standard JumpList for the app (managed by Windows).

    The bottommost item in the jumplist will always be an item pointing to the current app. Its name is taken from the manifest's shortcut.name and uses shortcut.company as a fallback. Clicking that item will launch the app from its current manifest.

    Note: If the "name" property is omitted it defaults to "tasks".

    Note: Window OS caches jumplists icons, therefore an icon change might only be visible after the cache is removed or the uuid or shortcut.name is changed.

    Example

        const app = fin.Application.getCurrentSync();
    const appName = 'My App';
    const jumpListConfig = [ // array of JumpList categories
    {
    // has no name and no type so `type` is assumed to be "tasks"
    items: [ // array of JumpList items
    {
    type: 'task',
    title: `Launch ${appName}`,
    description: `Runs ${appName} with the default configuration`,
    deepLink: 'fins://path.to/app/manifest.json',
    iconPath: 'https://path.to/app/icon.ico',
    iconIndex: 0
    },
    { type: 'separator' },
    {
    type: 'task',
    title: `Restore ${appName}`,
    description: 'Restore to last configuration',
    deepLink: 'fins://path.to/app/manifest.json?$$use-last-configuration=true',
    iconPath: 'https://path.to/app/icon.ico',
    iconIndex: 0
    },
    ]
    },
    {
    name: 'Tools',
    items: [ // array of JumpList items
    {
    type: 'task',
    title: 'Tool A',
    description: 'Runs Tool A',
    deepLink: 'fins://path.to/tool-a/manifest.json',
    iconPath: 'https://path.to/tool-a/icon.ico',
    iconIndex: 0
    },
    {
    type: 'task',
    title: 'Tool B',
    description: 'Runs Tool B',
    deepLink: 'fins://path.to/tool-b/manifest.json',
    iconPath: 'https://path.to/tool-b/icon.ico',
    iconIndex: 0
    }]
    }
    ];

    app.setJumpList(jumpListConfig).then(() => console.log('JumpList applied')).catch(e => console.log(`JumpList failed to apply: ${e.toString()}`));

    To handle deeplink args:

        function handleUseLastConfiguration() {
    // this handler is called when the app is being launched
    app.on('run-requested', event => {
    if(event.userAppConfigArgs['use-last-configuration']) {
    // your logic here
    }
    });
    // this handler is called when the app was already running when the launch was requested
    fin.desktop.main(function(args) {
    if(args && args['use-last-configuration']) {
    // your logic here
    }
    });
    }
  • Sets the query string in all shortcuts for this app. Requires RVM 5.5+.

    Parameters

    • queryString: string

      The new query string for this app's shortcuts.

    Returns Promise<void>

    Example

    const newQueryArgs = 'arg=true&arg2=false';
    const app = await fin.Application.getCurrent();
    try {
    await app.setShortcutQueryParams(newQueryArgs);
    } catch(err) {
    console.error(err)
    }
  • Sets new application's shortcut configuration. Windows only.

    Parameters

    Returns Promise<void>

    Remarks

    Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to be able to change shortcut states.

    Example

    async function setShortcuts(config) {
    const app = await fin.Application.getCurrent();
    return app.setShortcuts(config);
    }

    setShortcuts({
    desktop: true,
    startMenu: false,
    systemStartup: true
    }).then(() => console.log('Shortcuts are set.')).catch(err => console.log(err));
  • Adds a customizable icon in the system tray. To listen for a click on the icon use the tray-icon-clicked event.

    Parameters

    • icon: string

      Image URL or base64 encoded string to be used as the icon

    Returns Promise<void>

    Example

    const imageUrl = "http://cdn.openfin.co/assets/testing/icons/circled-digit-one.png";
    const base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX\
    ///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII";
    const dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DH\
    xgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";

    async function setTrayIcon(icon) {
    const app = await fin.Application.getCurrent();
    return await app.setTrayIcon(icon);
    }

    // use image url to set tray icon
    setTrayIcon(imageUrl).then(() => console.log('Setting tray icon')).catch(err => console.log(err));

    // use base64 encoded string to set tray icon
    setTrayIcon(base64EncodedImage).then(() => console.log('Setting tray icon')).catch(err => console.log(err));

    // use a dataURL to set tray icon
    setTrayIcon(dataURL).then(() => console.log('Setting tray icon')).catch(err => console.log(err));
  • 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

    • level: number

      The zoom level

    Returns Promise<void>

    Example

    async function setZoomLevel(number) {
    const app = await fin.Application.getCurrent();
    return await app.setZoomLevel(number);
    }

    setZoomLevel(5).then(() => console.log('Setting a zoom level')).catch(err => console.log(err));
  • Closes the application by terminating its process.

    Returns Promise<void>

    Example

    async function terminateApp() {
    const app = await fin.Application.getCurrent();
    return await app.terminate();
    }
    terminateApp().then(() => console.log('Application terminated')).catch(err => console.log(err));