OpenFin Workspace Platform API
    Preparing search index...

    Interface WorkspacePlatformStorage

    API for interacting with persistent storage.

    interface WorkspacePlatformStorage {
        createPage(page: CreateSavedPageRequest): Promise<void>;
        createWorkspace(workspace: CreateSavedWorkspaceRequest): Promise<void>;
        deletePage(id: string): Promise<void>;
        deleteWorkspace(id: string): Promise<void>;
        getDockProviderConfig(id: string): Promise<DockProviderConfigWithIdentity>;
        getPage(id: string): Promise<Page>;
        getPages(): Promise<Page[]>;
        getWorkspace(id: string): Promise<Workspace>;
        getWorkspaces(): Promise<Workspace[]>;
        getWorkspacesMetadata(): Promise<
            Pick<Workspace, "title" | "workspaceId">[],
        >;
        saveDockProviderConfig(
            config: DockProviderConfigWithIdentity,
        ): Promise<void>;
        savePage(page: Page): Promise<void>;
        saveWorkspace(workspace: Workspace): Promise<void>;
        updatePage(req: UpdateSavedPageRequest): Promise<void>;
        updateWorkspace(req: UpdateSavedWorkspaceRequest): Promise<void>;
    }
    Index
    • Create a page in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const layout = {
      content: [
      {
      type: 'stack',
      content: [
      {
      type: 'component',
      componentName: 'view',
      componentState: {
      name: 'myViewName',
      url: 'http://google.com'
      }
      }
      ]
      }
      ]
      };
      const page = {
      title: 'myPageTitle',
      pageId: 'myPageId',
      layout
      };
      await workspacePlatform.Storage.createPage({page});

      Parameters

      Returns Promise<void>

    • Delete a page from persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      await workspacePlatform.Storage.deletePage('myPageId');

      Parameters

      • id: string

        the id of the page to delete.

      Returns Promise<void>

    • Delete a workspace from persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      await workspacePlatform.Storage.deleteWorkspace('myWorkspaceId');

      Parameters

      • id: string

        the id of the workspace to delete.

      Returns Promise<void>

    • Implementation for getting the dock provider from persistent storage.

      Parameters

      • id: string

        The id of the dock provider to get.

      Returns Promise<DockProviderConfigWithIdentity>

    • Get a specific page in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const myPage = await workspacePlatform.Storage.getPage('myPageId');

      Parameters

      • id: string

        the id of the page to get.

      Returns Promise<Page>

      a page object or undefined if page doesn't exist.

    • Get all pages that are saved in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const pages = await workspacePlatform.Storage.getPages();

      Returns Promise<Page[]>

    • Get a specific workspace in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const myWorkspace = await workspacePlatform.Storage.getWorkspace('myWorkspaceId');

      Parameters

      • id: string

        the id of the workspace to get.

      Returns Promise<Workspace>

      a workspace object or undefined if workspace doesn't exist.

    • Get all workspaces that are saved in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const workspaces = await workspacePlatform.Storage.getWorkspaces();

      Returns Promise<Workspace[]>

    • Get all workspaces metadata including the workspaceId and title that are saved in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const workspacesMetadata = await workspacePlatform.Storage.getWorkspacesMetadata();

      Returns Promise<Pick<Workspace, "title" | "workspaceId">[]>

    • Implementation for saving a dock provider config to persistent storage.

      Parameters

      • config: DockProviderConfigWithIdentity

        The new dock config to save to persistent storage.

      Returns Promise<void>

    • Save a page in persistent storage.

      This is a helper function that will call getPage to determine if a page is already in storage. If the page is already in storage, it will call updatePage. If it does not exist in storage, the function will call createPage instead.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const layout = {
      content: [
      {
      type: 'stack',
      content: [
      {
      type: 'component',
      componentName: 'view',
      componentState: {
      name: 'myViewName',
      url: 'http://google.com'
      }
      }
      ]
      }
      ]
      };
      const page = {
      title: 'myPageTitle',
      pageId: 'myPageId',
      layout
      };
      await workspacePlatform.Storage.savePage(page);

      Parameters

      • page: Page

        the page to save.

      Returns Promise<void>

    • Save a workspace in persistent storage.

      This is a helper function that will call getWorkspace to determine if a workspace is already in storage. If the workspace is already in storage, it will call updateWorkspace. If it does not exist in storage, the function will call createWorkspace instead.

      Parameters

      • workspace: Workspace

        the workspace to save.

      Returns Promise<void>

    • Update a page in persistent storage.

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

      const workspacePlatform = WorkspacePlatform.getCurrentSync();
      const layout = {
      content: [
      {
      type: 'stack',
      content: [
      {
      type: 'component',
      componentName: 'view',
      componentState: {
      name: 'myViewName',
      url: 'http://google.com'
      }
      }
      ]
      }
      ]
      };
      const page = {
      title: 'myPageTitle',
      pageId: 'myPageId',
      layout
      };
      const req = {
      pageId: 'myPageId',
      page
      };
      await workspacePlatform.Storage.updatePage(req);

      Parameters

      Returns Promise<void>