AboutSupportDeveloper GuideVersion 17.0.14

Interface WorkspacePlatformModule

Controller for a Workspace Platform.

Hierarchy

  • Platform
    • WorkspacePlatformModule

Properties

Application: Application

The browser window factory for the Workspace Platform.

Layout: LayoutModule

The storage API for the Workspace Platform.

Theme: ThemeApi

Theme API for the Workspace Platform.

eventNames: (() => (string | symbol)[])

Type declaration

    • (): (string | symbol)[]
    • Returns (string | symbol)[]

getClient: ((identity?) => Promise<ChannelClient>)

Type declaration

    • (identity?): Promise<ChannelClient>
    • Parameters

      • Optional identity: ApplicationIdentity_2

      Returns Promise<ChannelClient>

identity: ApplicationIdentity_2
listenerCount: ((type) => number)

Type declaration

    • (type): number
    • Parameters

      • type: string | symbol

      Returns number

listeners: ((type) => Function[])

Type declaration

    • (type): Function[]
    • Parameters

      • type: string | symbol

      Returns Function[]

Accessors

  • get me(): Identity_5
  • Provides access to the OpenFin representation of the current code context (usually a document such as a OpenFin.View or OpenFin.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_5

Methods

  • Parameters

    • events: AnalyticsEventInternal[]

    Returns Promise<void>

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

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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

    • eventType: EventType
    • listener: EventHandler<Event_10, EventType>
    • Optional options: SubscriptionOptions

    Returns Promise<WorkspacePlatformModule>

  • Launch a browser snapshot that contains windows with pages.

    Parameters

    • snapshot: string | BrowserSnapshot

      the browser snapshot to launch or a url or filepath to retrieve a JSON snapshot.

    • Optional options: ApplySnapshotOptions

    Returns Promise<Platform>

  • Applies the given workspace to the user's desktop. Makes that workspace the active workspace.

    Parameters

    Returns Promise<boolean>

    true if the workspace was applied, false if the workspace was not applied.

    Example

    Brief example of how to apply a workspace, currently stored in storage, to the desktop.

    const workspacePlatform = getCurrentSync();

    // This assumes that there is at least one workspace in storage.
    const allWorkspaces = await workspacePlatform.Storage.getWorkspaces();

    // Apply the first workspace in storage to the desktop.
    await workspacePlatform.applyWorkspace(allWorkspaces[0], {
    // Customize the behavior of the applyWorkspace call.
    skipPrompt: false,
    applySnapshotOptions: {
    closeExistingWindows: false,
    closeSnapshotWindows: false,
    skipOutOfBoundsCheck: false,
    },
    });
  • Closes a specified view in a target window.

    Parameters

    • viewIdentity: Identity_5

      View identity

    Returns Promise<void>

    Example

    let windowIdentity;
    if (fin.me.isWindow) {
    windowIdentity = fin.me.identity;
    } else if (fin.me.isView) {
    windowIdentity = (await fin.me.getCurrentWindow()).identity;
    } else {
    throw new Error('Not running in a platform View or Window');
    }

    const viewOptions = {
    name: 'test_view',
    url: 'https://example.com'
    };

    function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
    }

    const platform = await fin.Platform.getCurrent();

    await platform.createView(viewOptions, windowIdentity);
    // a new view will now show in the current window

    await sleep(5000);

    const viewIdentity = { uuid: windowIdentity.uuid, name: 'test_view'};
    platform.closeView(viewIdentity);
    // the view will now close
  • Experimental

    Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.

    Parameters

    • windowId: Identity_5
    • Optional options: {
          skipBeforeUnload: boolean;
      }
      • skipBeforeUnload: boolean

    Returns Promise<void>

    Remarks

    This method works by setting a close-requested handler on the Platform Window. If you have your own close-requested handler set on the Platform Window as well, it is recommended to move that logic over to the [PlatformProvider.closeWindow]PlatformProvider#closeWindow override to ensure it runs when the Window closes.

    Example

    // Close the current Window inside a Window context
    const platform = await fin.Platform.getCurrent();
    platform.closeWindow(fin.me.identity);

    // Close the Window from inside a View context
    const platform = await fin.Platform.getCurrent();
    const parentWindow = await fin.me.getCurrentWindow();
    platform.closeWindow(parentWindow.identity);

    // Close the Window and do not fire the before unload handler on Views
    const platform = await fin.Platform.getCurrent();
    platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
  • Use when you need to create a View into Browser window. In addition to what regular platfom createView offers, here you can specify workspacePlatform options for settings related to Workspace Platform.

    For general details about this method, see docs for @openfin/core.

    Parameters

    • viewOptions: BrowserCreateViewRequest | Partial<ViewOptions>
    • Optional target: CreateViewTarget
    • Optional targetView: Identity_5

    Returns Promise<View_2>

    Example

    import * as WP from "@openfin/workspace-platform";

    const platform = WP.getCurrentSync();

    platform.createView({
    url: "https://url-to-your-app.com",
    ...,
    workspacePlatform: {
    browserNavigationButtons: {
    reload: false,
    back: true,
    forward: true
    }
    }
    });
  • Creates a new Window.

    Parameters

    • options: PlatformWindowCreationOptions

      Window creation options

    Returns Promise<_Window & Identity_5>

    Remarks

    There are two Window types at your disposal while using OpenFin Platforms - Default Window and Custom Window.

    The Default Window uses the standard OpenFin Window UI. It contains the standard close, maximize and minimize buttons, and will automatically render the Window's layout if one is specified.

    For deeper customization, you can bring your own Window code into a Platform. This is called a Custom Window.

    Example

    The example below will create a Default Window which uses OpenFin default Window UI.
    The Window contains two Views in a stack Layout:

    const platform = fin.Platform.getCurrentSync();
    platform.createWindow({
    layout: {
    content: [
    {
    type: 'stack',
    content: [
    {
    type: 'component',
    componentName: 'view',
    componentState: {
    name: 'test_view_1',
    url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html'
    }
    },
    {
    type: 'component',
    componentName: 'view',
    componentState: {
    name: 'test_view_2',
    url: 'https://cdn.openfin.co/docs/javascript/canary/Platform.html'
    }
    }
    ]
    }
    ]
    }
    }).then(console.log);

    The Default Window's design can be customized by specifying the stylesheetUrl property in the manifest:

    {
    platform: {
    defaultWindowOptions: {
    stylesheetUrl: 'some-url.css',
    ...
    }
    }
    }

    For a list of common Layout CSS classes you can override in your custom stylesheet, see Useful Layout CSS Classes * To specify a Platform Custom Window, provide a url property when creating a Window. If you intend to render a Layout in your Custom Window, you must also specify an HTMLElement that the Layout will inject into and set its id property to "layout-container".

    The example below will create a Platform Custom Window:

        // in an OpenFin app:
    const platform = fin.Platform.getCurrentSync();
    const windowConfig =
    {
    url: "https://www.my-domain.com/my-custom-window.html", // here we point to where the Custom Frame is hosted.
    layout: {
    content: [
    {
    type: "stack",
    content: [
    {
    type: "component",
    componentName: "view",
    componentState: {
    name: "app #1",
    url: "https://cdn.openfin.co/docs/javascript/canary/Platform.html"
    }
    },
    {
    type: "component",
    componentName: "view",
    componentState: {
    name: "app #2",
    url: "https://cdn.openfin.co/docs/javascript/canary/Platform.html"
    }
    }
    ]
    }
    ]
    }
    };
    platform.createWindow(windowConfig);

    Here's an example of a minimalist Custom Platform Window implementation:

    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="./styles.css">
    </head>
    <body>
    <div id="of-frame-main">
    <div id="title-bar">
    <div class="title-bar-draggable">
    <div id="title"> This is a custom frame! </div>
    </div>
    <div id="buttons-wrapper">
    <div class="button" id="minimize-button"></div>
    <div class="button" id="expand-button"></div>
    <div class="button" id="close-button"></div>
    </div>
    </div>
    <div id="layout-container"></div> <!-- OpenFin layout would be injected here -->
    <script src="./custom-frame.js"></script>
    </div>
    </body>
    </html>

    Your Custom Window can use in-domain resources for further customization (such as CSS, scripts, etc.).
    For a list of common Layout CSS classes you can override in your stylesheet, see Useful Layout CSS Classes

    The example above will require the body element to have height: 100%; set in order to render the layout correctly.

  • Fetches a JSON manifest using the browser process and returns a Javascript object. Can be overwritten using Platform.PlatformModule.init Platform.init.

    Parameters

    • manifestUrl: string

      The URL of the manifest to fetch.

    Returns Promise<any>

    Remarks

    Can be overwritten using Platform#init Platform.init.

    Example

    const platform = fin.Platform.getCurrentSync();
    const manifest = await platform.fetchManifest('https://www.path-to-manifest.com/app.json');
    console.log(manifest);
  • Gets a workspace data structure that represents the current state of the user's desktop.

    Returns Promise<Workspace>

  • Get a snapshot that contains browser windows with pages.

    Returns Promise<BrowserSnapshot>

  • Preferred way of getting View options with Workspace Platform.

    Parameters

    • viewIdentity: Identity_5

    Returns Promise<BrowserViewState>

    Example

    import * as WP from "@openfin/workspace-platform";

    const platform = WP.getCurrentSync();
    const view = await platform.createView(options);
    const viewOptions = await platform.getViewSnapshot(view.identity);

    console.log(viewOptions.workspacePlatform);
  • Experimental

    Get the context context of a host window that was previously set using Platform#setWindowContext setWindowContext. The context will be saved in any platform snapshots. Returns a promise that resolves to the context.

    Parameters

    • Optional target: Identity_5

      A target window or view may optionally be provided. If no target is provided, target will be the current window (if called from a Window) or the current host window (if called from a View).

    Returns Promise<any>

    Remarks

    This method can be called from the window itself, or from any child view. Context data is shared by all entities within a window.

    Example

    Retrieving context from current window:

    const platform = fin.Platform.getCurrentSync();
    const customContext = { answer: 42 };
    await platform.setWindowContext(customContext);

    const myContext = await platform.getWindowContext();
    console.log(myContext); // { answer: 42 }

    Retrieving the context of another window or view:

    const platform = fin.Platform.getCurrentSync();

    const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };

    const targetWindowContext = await platform.getWindowContext(windowOrViewIdentity);
    console.log(targetWindowContext); // context of target window
  • Launch an application.

    Parameters

    Returns Promise<void>

    Deprecated

    This method is deprecated. It is recommended to use createView or createWindow instead.

    import * as WorkspacePlatform from '@openfin/workspace-platform';

    const workspacePlatform = WorkspacePlatform.getCurrentSync();
    const req = {
    app: {
    appId: 'myAppId',
    title: 'appTitle',
    manifest: 'http://localhost/app.json',
    manifestType: AppManifestType.Manifest,
    icons:[
    {
    icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
    src: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
    type: "ico",
    },
    ]
    }
    }
    workspacePlatform.launchApp(req);
  • Experimental

    Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that resolves to the wrapped Platform.

    Parameters

    • manifestUrl: string

      The URL of the manifest that will be launched into the platform. If this app manifest contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options will be launched into the platform. The applicable startup_app options will become OpenFin.ViewCreationOptions View Options.

    Returns Promise<Platform>

    Remarks

    If the app manifest contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options will be launched into the platform as a window with a single view. The applicable startup_app options will become View Options.

    Example

    try {
    const platform = fin.Platform.getCurrentSync();
    await platform.launchContentManifest('http://localhost:5555/app.json');
    console.log(`content launched successfully into platform`);
    } catch(e) {
    console.error(e);
    }
    // For a local manifest file:
    try {
    const platform = fin.Platform.getCurrentSync();
    platform.launchContentManifest('file:///C:/somefolder/app.json');
    console.log(`content launched successfully into platform`);
    } catch(e) {
    console.error(e);
    }
  • Adds a listener to the end of the listeners array for the specified event.

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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

    • eventType: EventType
    • listener: EventHandler<Event_10, EventType>
    • Optional options: SubscriptionOptions

    Returns Promise<WorkspacePlatformModule>

    Remarks

    Event payloads are documented in the OpenFin.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" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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

    • eventType: EventType
    • listener: EventHandler<Event_10, EventType>
    • Optional options: SubscriptionOptions

    Returns Promise<WorkspacePlatformModule>

    Remarks

    Event payloads are documented in the OpenFin.Events namespace.

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

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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

    • eventType: EventType
    • listener: EventHandler<Event_10, EventType>
    • Optional options: SubscriptionOptions

    Returns Promise<WorkspacePlatformModule>

    Remarks

    Event payloads are documented in the OpenFin.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" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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

    • eventType: EventType
    • listener: EventHandler<Event_10, EventType>
    • Optional options: SubscriptionOptions

    Returns Promise<WorkspacePlatformModule>

    Remarks

    Event payloads are documented in the OpenFin.Events namespace.

  • Closes current platform, all its windows, and their views.

    Returns Promise<void>

    Example

    const platform = await fin.Platform.getCurrent();
    platform.quit();
    // All windows/views in current layout platform will close and platform will shut down
  • Removes all listeners, or those of the specified event.

    Parameters

    • Optional eventType: "crashed" | "started" | "closed" | "initialized" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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<WorkspacePlatformModule>

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

    Type Parameters

    • EventType extends "crashed" | "started" | "closed" | "initialized" | "window-alert-requested" | "window-created" | "window-end-load" | "window-not-responding" | "window-responding" | "window-start-load" | "connected" | "manifest-changed" | "not-responding" | "responding" | "run-requested" | "tray-icon-clicked" | "file-download-location-changed" | "platform-api-ready" | "platform-snapshot-applied" | "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" | "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-script-state-changed" | "window-preload-script-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

    • eventType: EventType
    • listener: EventHandler<Event_10, EventType>
    • Optional options: SubscriptionOptions

    Returns Promise<WorkspacePlatformModule>

    Remarks

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

  • DEPRECATED - please use Platform.createView Platform.createView. Reparents a specified view in a new target window.

    Parameters

    • viewIdentity: Identity_5

      View identity

    • target: Identity_5

      new owner window identity

    Returns Promise<View_2>

  • Sets the workspace as the current active workspace. Does not apply the workspace to the user's desktop.

    Parameters

    • workspace: Workspace

      the workspace to set as current active workspace.

    Returns Promise<void>

  • Experimental

    Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots. It can be retrieved using Platform#getWindowContext getWindowContext.

    Parameters

    • Optional context: any

      A field where serializable context data can be stored to be saved in platform snapshots.

    • Optional target: Identity_5

      A target window or view may optionally be provided. If no target is provided, the update will be applied to the current window (if called from a Window) or the current host window (if called from a View).

    Returns Promise<void>

    Remarks

    The context data must be serializable. This can only be called from a window or view that has been launched into a platform. This method can be called from the window itself, or from any child view. Context data is shared by all entities within a window.

    Example

    Setting own context:

    const platform = fin.Platform.getCurrentSync();
    const contextData = {
    security: 'STOCK',
    currentView: 'detailed'
    }

    await platform.setWindowContext(contextData);
    // Context of current window is now set to `contextData`

    Setting the context of another window or view:

    const platform = fin.Platform.getCurrentSync();
    const contextData = {
    security: 'STOCK',
    currentView: 'detailed'
    }

    const windowOrViewIdentity = { uuid: fin.me.uuid, name: 'nameOfWindowOrView' };
    await platform.setWindowContext(contextData, windowOrViewIdentity);
    // Context of the target window or view is now set to `contextData`

    A view can listen to changes to its host window's context by listening to the host-context-changed event. This event will fire when a host window's context is updated or when the view is reparented to a new window:

    // From a view
    const contextChangeHandler = ({ context }) => {
    console.log('Host window\'s context has changed. New context data:', context);
    // react to new context data here
    }
    await fin.me.on('host-context-changed', contextChangeHandler);

    const platform = await fin.Platform.getCurrentSync();
    const contextData = {
    security: 'STOCK',
    currentView: 'detailed'
    }
    platform.setWindowContext(contextData) // contextChangeHandler will log the new context

    To listen to a window's context updates, use the context-changed event:

    // From a window
    const contextChangeHandler = ({ context }) => {
    console.log('This window\'s context has changed. New context data:', context);
    // react to new context data here
    }
    await fin.me.on('context-changed', contextChangeHandler);

    const platform = await fin.Platform.getCurrentSync();
    const contextData = {
    security: 'STOCK',
    currentView: 'detailed'
    }
    platform.setWindowContext(contextData) // contextChangeHandler will log the new context