Synchronously returns a Browser Window object that represents an existing window
of the window
Create a new 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
};
const options: BrowserCreateWindowRequest = {
workspacePlatform: {
pages: [page],
title: 'My Window Title',
favicon: 'https://google.com/favicon.ico',
disableMultiplePages: true, // disable page functionality for the window
toolbarOptions: { // configure the set of tray icons for the window
buttons: [
{ // adding a custom tray icon for the window
type: BrowserButtonType.Custom,
tooltip: 'Sample Tray Icon',
disabled: false,
iconUrl: 'https://www.openfin.co/favicon.ico',
action: {
// This action needs to be registed in customActions property in the call WorkspacePlatform.init
id: 'sample-trayicon-custom-action',
customData: {
message: 'Clicked on custom Toolbar button'
}
}
},
{
type: BrowserButtonType.ShowHideTabs
},
{
type: BrowserButtonType.ColorLinking
},
{
type: BrowserButtonType.PresetLayouts
},
{
type: BrowserButtonType.SaveMenu
}
]
}
windowStateButtonOptions: {
//configure the set of icons for setting window states
buttons: [
{ // adding a custom window state icon for the window
id: 'windowState123',
type: BrowserButtonType.Custom,
tooltip: 'Sample Window State button',
disabled: false,
iconUrl: 'https://www.openfin.co/favicon.ico',
action: {
// This action needs to be registered in customActions property in the call WorkspacePlatform.init
id: 'sample-window-state-custom-action',
customData: {
message: 'Clicked on custom Window State button'
}
}
},
{ // override tooltip and icon URL for standard Maximise button
type: BrowserButtonType.Maximise,
tooltip: overrideWindowStateIcons ? 'Studio Maximise' : undefined,
iconUrl: overrideWindowStateIcons ? 'https://www.openfin.co/favicon.ico' : undefined
},
{
type: BrowserButtonType.Minimise
},
{
type: BrowserButtonType.Close
}
]
}
}
};
const window = await workspacePlatform.Browser.createWindow(options);
the browser window creation options
View names are singleton: It is not recommended to provide view names, but if they are provided, they can only be used by one view at a time.
Expected Behavior: If a new view is created using the same view name as an already existing view, the new view will be created, with the view name, and the existing view will be destroyed.
Get a list of all pages that are attached to any running browser window.
import * as WorkspacePlatform from '@openfin/workspace-platform';
const workspacePlatform = WorkspacePlatform.getCurrentSync();
const attachedPages = await workspacePlatform.Browser.getAllAttachedPages();
Get all the Browser Windows that are running in the Workspace Platform.
import * as WorkspacePlatform from '@openfin/workspace-platform';
const workspacePlatform = WorkspacePlatform.getCurrentSync();
const windows = await workspacePlatform.Browser.getAllWindows();
Get the identity of the last focused Browser window.
import * as WorkspacePlatform from '@openfin/workspace-platform';
const workspacePlatform = WorkspacePlatform.getCurrentSync();
const windowIdentity = await workspacePlatform.Browser.getLastFocusedWindow();
Get a unique title for a page.
import * as WorkspacePlatform from '@openfin/workspace-platform';
const workspacePlatform = WorkspacePlatform.getCurrentSync();
const uniqueTitle = await workspacePlatform.Browser.getUniquePageTitle('myTitle');
Optional
title: stringa prefix for the title.
Factory for wrapping browser windows and global operations.