Options
All
  • Public
  • Public/Protected
  • All
Menu

@openfin/workspace-platform

Index

Type aliases

AttachedPage

AttachedPage: Page & AttachedPageMetadata

BrowserOverrideCallback

BrowserOverrideCallback: OpenFin.OverrideCallback<WorkspacePlatformProvider>

Extend or replace default functionality in order to customize behavior of a Workspace Platform Provider.

To implement your own handlers for Workspace Platform behavior, extend the provided class and override any methods you'd like to alter.

import * as WorkspacePlatform from '@openfin/workspace-platform';
import { UpdateSavedPageRequest } from '@client-platform/shapes';

const overrideCallback: WorkspacePlatform.BrowserOverrideCallback = async (
WorkspacePlatformProvider
) => {
class Override extends WorkspacePlatformProvider {
// ovrride default behavior of updateSavedPage
updateSavedPage = async (req: UpdateSavedPageRequest): Promise<void> => {
console.log(`saving page ${req.page.pageId}`);
// calling custom function to the save page here
};

// add a custom menu item in Global Context Menu
openGlobalContextMenu(req: WorkspacePlatform.OpenGlobalContextMenuPayload, callerIdentity: any) {
return super.openGlobalContextMenu(
{
...req,
template: [
...req.template,
{
label: 'Sample custom global option',
data: {
type: GlobalContextMenuOptionType.Custom,
action: {
// This action needs to be registed in customActions property in the call WorkspacePlatform.init
id: 'sample-custom-global-menu-action'
}
}
}
]
},
callerIdentity
);
}

// add a custom menu item in View Tab Context Menu
openViewTabContextMenu = async (payload: OpenViewTabContextMenuPayload, callerIdentity) => {
return super.openViewTabContextMenu({
...payload,
template: [
{
label: 'Sample View Tab Context Menu',
data: {
type: ViewTabMenuOptionType.Custom,
action: {
// This action needs to be registed in customActions property in the call WorkspacePlatform.init
id: 'sample-viewtab-action',
customData: 'Custom View Tab Action'
}
}
},
...payload.template
]
}, callerIdentity);
};


}
return new Override();
};

await WorkspacePlatform.init({
browser: { overrideCallback },
customActions: {
'sample-custom-global-menu-action': (payload: CustomActionPayload) => {
alert('This custom action works ' + JSON.stringify(payload));
return 'someresponse';
},
'sample-viewtab-action': (payload: ViewTabCustomActionPayload) => {
alert('This custom action works ' + JSON.stringify(payload));
return 'someresponse';
}
}


});

BrowserSnapshotWindow

BrowserSnapshotWindow: OpenFin.WindowCreationOptions & BrowserCreateWindowRequest

A window that is part of a browser snapshot.

CustomActionPayload

The payload received by a Custom Action. The callerType property can be used to determine what data is available in the payload and cast accordingly. When callerType == CustomActionCallerType.API, the payload is defined by the code directly invoking the action.

OpenGlobalContextMenuPayload

OpenGlobalContextMenuPayload: OpenGlobalContextMenuRequest & { identity: NamedIdentity; template: GlobalContextMenuItemTemplate[]; callback: any }

Payload received by the openGlobalContextMenu provider override.

OpenPageTabContextMenuPayload

OpenPageTabContextMenuPayload: OpenPageTabContextMenuRequest & { identity: NamedIdentity; template: PageTabContextMenuItemTemplate[]; callback: any }

Payload received by the openViewTabContextMenu provider override.

OpenViewTabContextMenuPayload

OpenViewTabContextMenuPayload: OpenViewTabContextMenuRequest & { identity: NamedIdentity; callback: any }

Payload received by the openViewTabContextMenu provider override.

PageLayout

PageLayout: LayoutExtended & { layoutDetails?: PageLayoutDetails }

PageWithUpdatableRuntimeAttribs

PageWithUpdatableRuntimeAttribs: Page & Pick<AttachedPage, "hasUnsavedChanges">

ToolbarButton

ToolbarButton: ShowHideTabsConfig | CustomBrowserButtonConfig | PreDefinedButtonConfig

Buttons on the left of WindowStateButtonOptions

WindowStateButton

Buttons to the top far right of Browser

Functions

Const getCurrentSync

Const init

  • Initilaize a Workspace Platform.

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

    const customThemes: WorkspacePlatform.CustomThemes = [{
    label: "OpenFin's Custom Theme",
    palette: {
    // Required color options
    brandPrimary: '#F51F63',
    brandSecondary: '#1FF58A',
    backgroundPrimary: '#F8E71C', // hex, rgb/rgba, hsl/hsla only - no string colors: 'red'
    }
    }

    const overrideCallback: WorkspacePlatform.BrowserOverrideCallback = async (
    WorkspacePlatformProvider
    ) => {
    class Override extends WorkspacePlatformProvider {
    async quit(payload, callerIdentity) {
    return super.quit(payload, callerIdentity);
    }
    }
    return new Override();
    };


    await WorkspacePlatform.init({
    browser: { overrideCallback },
    theme: customThemes
    });

    Parameters

    Returns Promise<void>

Const wrapSync

Generated using TypeDoc