Options
All
  • Public
  • Public/Protected
  • All
Menu

External module Workspaces

Index

Events

addEventListener

  • addEventListener(eventType: "workspace-restored", listener: function): Promise<void>
  • addEventListener(eventType: "workspace-generated", listener: function): Promise<void>
  • Event fired when a workspace is restored.

    The event will contain the full detail of the Workspace.

    import {workspaces} from 'openfin-layouts';
    
    workspaces.addEventListener('workspace-restored', async (event: WorkspaceRestoredEvent) => {
         console.log(`Properties for the restored workspace: ${event.detail}`);
    });
    type

    workspace-restored

    Parameters

    Returns Promise<void>

  • Event fired whenever a workspace is generated.

    The event will contain the full detail of the Workspace.

    import {workspaces} from 'openfin-layouts';
    
    workspaces.addEventListener('workspace-generated', async (event: WorkspaceGeneratedEvent) => {
        console.log(`Properties for the generated workspace: ${event.detail}`);
    });
    type

    workspace-generated

    Parameters

    Returns Promise<void>

Functions

generate

  • Generates a JSON object that contains the state of the current desktop.

    The returned JSON will contain the main application window of every application that is currently open and hasn't explicitly de-registered itself using the layouts service API. Child windows will not be included by default - the returned workspace object will only contain child window data for applications that integrate with the layouts service by registering save and restore callbacks.

    TODO: Document workspace generation process

    Returns Promise<Workspace>

ready

  • Send this to the service when you have registered all routes after registration.

    When restoring a workspace, the service will refrain from passing the saved workspace to the application (via the setRestoreHandler callback) until after the application has used this function to signal that it is ready.

    Note that by not calling this function, and workspace restore operation will hang indefinitely.

    Returns Promise<Workspace>

restore

  • Takes a workspace created by generate and restores the applications within it.

    The returned JSON will contain the main application window of every application that is currently open and hasn't explicitly de-registered itself using the layouts service API. Child windows will not be included by default - the returned workspace object will only contain child window data for applications that integrate with the layouts service by registering save and restore callbacks.

    TODO: Document workspace restoration process

    Parameters

    Returns Promise<Workspace>

setGenerateHandler

  • setGenerateHandler(customDataDecorator: function): Promise<boolean>
  • Register a callback that will save the state of the calling application.

    The callback will be invoked on each call to generate, and the return value (if anything is returned) will be saved as the workspace's customData property for this app within the generated Workspace.

    Parameters

    Returns Promise<boolean>

setRestoreHandler

  • setRestoreHandler(listener: function): Promise<boolean>
  • Registers a callback that will restore the application to a previous state.

    It is up to applications whether this action should "append" or "replace" the current workspace. The service will not close any applications that are currently open and not in the workspace; though applications may do this if they wish.

    Parameters

    Returns Promise<boolean>