Options
All
  • Public
  • Public/Protected
  • All
Menu

Controller for interacting with a browser window.

Hierarchy

  • BrowserWindowModule

Index

Properties

identity

identity: Identity

The identity of the browser window.

openfinWindow

openfinWindow: _Window

Underlying OpenFin window Controller.

Methods

addPage

  • Attach a page to a browser window. If a page with same id or title is attached to an existing browser window, an error will be thrown.

    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
    };
    // assume a browser window already exists
    const windows = await workspacePlatform.Browser.getAllWindows();
    await windows[0].addPage(page);
    // focus window
    await windows[0].openfinWindow.focus();
    // restore window if minimized
    await windows[0].openfinWindow.restore();

    Parameters

    Returns Promise<void>

getPage

  • Get a page that is attached to the browser window.

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

    const workspacePlatform = WorkspacePlatform.getCurrentSync();
    // assume a browser window already exists
    const windows = await workspacePlatform.Browser.getAllWindows();
    const page = await windows[0].getPage('MyPageId');

    Parameters

    • id: string

      the id of the page to get.

    Returns Promise<AttachedPage>

getPages

  • Return all the pages that are attached to a browser window.

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

    const workspacePlatform = WorkspacePlatform.getCurrentSync();
    // assume a browser window already exists
    const windows = await workspacePlatform.Browser.getAllWindows();
    const pages = await windows[0].getPages();

    Returns Promise<AttachedPage[]>

removePage

  • removePage(id: string): Promise<void>
  • Remove an attached page from the browser window.

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

    const workspacePlatform = WorkspacePlatform.getCurrentSync();
    // assume a browser window already exists
    const windows = await workspacePlatform.Browser.getAllWindows();
    await windows[0].removePage('myPageId');

    Parameters

    • id: string

      the id of the attached page to remove from the browser window.

    Returns Promise<void>

reorderPages

  • Reorder pages attached to the browser window.

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

    const workspacePlatform = WorkspacePlatform.getCurrentSync();
    // assume a browser window already exists and has three pages in it
    const windows = await workspacePlatform.Browser.getAllWindows();
    await windows[0].reorderPages(['myPageId2', 'myPageId1', 'myPageId3']);

    Parameters

    Returns Promise<void>

setActivePage

  • setActivePage(id: string): Promise<void>
  • Set the active page for the browser window.

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

    const workspacePlatform = WorkspacePlatform.getCurrentSync();
    // assume a browser window already exists
    const windows = await workspacePlatform.Browser.getAllWindows();
    await windows[0].setActivePage('MyPageId');

    Parameters

    • id: string

      the id of the attached page to set as active.

    Returns Promise<void>

updatePage

  • Update a page in which is attached to the browser window.

    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
    };
    // assume a browser window already exists
    const windows = await workspacePlatform.Browser.getAllWindows();
    const req = {
    pageId: 'myPageId',
    page
    };
    await windows[0].updatePage(req);

    Parameters

    Returns Promise<void>

Generated using TypeDoc