Send messages between windows Messages can be sent between windows that are part of the same application.
Subscribe to messages based on a topic name, and either send messages
from or to a particular window id, or else distribute to all listening windows.
Messages are sent asynchronously.
Static Methods
send
Tests
15/15
Electron
5/5
OpenFin
5/5
Browser
5/5
Send a message to a specific window
Arguments
windowId [string]
The id of the window to send the message to. Can be a wildcard '*' to send to all listening windows.
topic [string]
The topic of the message.
message [string | any]
The message to send.
Returns
void
subscribe
Tests
12/12
Electron
4/4
OpenFin
4/4
Browser
4/4
Subscribe to message from a window/topic
Arguments
windowId [string]
The id of the window to listen to messages from. Can be a wildcard '*' to listen to all windows.
The function that was passed to subscribe. Note: this must be the same function object.
Returns
void
Notification
Creates a new Desktop Notification. Notifications are created via a constructor which takes a title and
an options object with body text and additional view options. A Notification emits click events when the user clicks on itOpenFin requires a template html file to render the notification.
A template (notification.html) is included with the containerjs bundle,
and by default ssf.Notification will try to find it in the same location
as the current URL. To specify a different URL for the template, set the
template setting in NotificationOptionsNotification is an EventEmitter.
See NotificationEvent for a list of events.
Static Methods
requestPermission
Request permission to create notifications If required, ask the user for permission to create desktop notifications.
Some containers don't require permission so will resolve the promise
immediately with the result "granted"
Returns
Promise<NotificationPermission>
A promise which resolves to a string value "granted" or "denied".
Exposes methods that relate to the Screen and Display Monitors.
Static Methods
getDisplays
Get all the monitor displays that are available. Note that the Browser API does not support multiple displays, so it
assumes the display the browser is running in is the only display.
A promise which resolves to an array of available displays.
Window
Creates and controls windows. The full Window interface is only available in OpenFin and Electron.
For Browser and features available in all platforms,
use WindowCore instead. Windows are created via a constructor which takes a configuration object
that details the window's behaviour.Window is an EventEmitter.
See WindowEvent for a list of events.
Captures the current visible content for the given Window. Returns the image as a base64 encoded png string. Note: For the browser, this is limited by the usual cross-domain rules.
Returns
Promise<string>
A promise that resolves to a base64 encoded png
close
Tests
9/9
Electron
3/3
OpenFin
3/3
Browser
3/3
Closes the window. Only works on windows created via the ContainerJS API in the browser.
Returns
Promise<void>
A promise which resolves to nothing when the function has completed.
eventNames
Get all event names with active listeners.
Returns
Array<string | symbol>
flashFrame
Tests
0/0
Electron
0/0
OpenFin
0/0
Flashes the window's frame and taskbar icon.
Arguments
flag [boolean]
Flag to start or stop the window flashing.
Returns
Promise<void>
A promise which resolves to nothing when the function has completed.
focus
Tests
0/0
Electron
0/0
OpenFin
0/0
Focuses the window.
Returns
Promise<void>
A promise which resolves to nothing when the function has completed.
A promise that resolves to nothing when the option is set.
setIcon
Tests
2/2
Electron
1/1
OpenFin
1/1
Sets the window icon.
Arguments
icon [string]
The url to the image.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setMaximizable
Tests
2/2
Electron
1/1
OpenFin
1/1
Sets if the window can be maximized.
Arguments
maximizable [boolean]
Set if the window can be maximized.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setMaximumSize
Tests
4/4
Electron
2/2
OpenFin
2/2
Sets the windows maximum size.
Arguments
maxWidth [number]
The maximum width of the window.
maxHeight [number]
The maximum height of the window.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setMinimizable
Tests
2/2
Electron
1/1
OpenFin
1/1
Sets if the window can be minimized.
Arguments
minimizable [boolean]
Set if the window can be minimized.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setMinimumSize
Tests
4/4
Electron
2/2
OpenFin
2/2
Sets the windows minimum size.
Arguments
minWidth [number]
The minimum width of the window.
minHeight [number]
The minimum height of the window.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setPosition
Tests
3/3
Electron
1/1
OpenFin
1/1
Browser
1/1
Sets the windows position.
Arguments
x [number]
The x position of the window.
y [number]
The y position of the window.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setResizable
Tests
2/2
Electron
1/1
OpenFin
1/1
Sets if the window is resizable.
Arguments
resizable [boolean]
If the window can be resized.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setSize
Tests
3/3
Electron
1/1
OpenFin
1/1
Browser
1/1
Sets the width and height of the window.
Arguments
width [number]
The width of the window.
height [number]
The height of the window.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setSkipTaskbar
Tests
0/0
Electron
0/0
OpenFin
0/0
Sets if the window is shown in the taskbar.
Arguments
skipTaskbar [boolean]
If the window is shown in the taskbar.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
show
Tests
0/0
Electron
0/0
OpenFin
0/0
Show the window.
Returns
Promise<void>
A promise that resolves to nothing when the window is showing.
unmaximize
Tests
2/2
Electron
1/1
OpenFin
1/1
Unmaximize the window.
Returns
Promise<void>
A promise that resolves to nothing when the window has unmaximized.
WindowCore
Creates and controls windows. WindowCore is implemented in the Browser, which offers a subset of the
features available in OpenFin and Electron. For OpenFin and Electron
specific behaviour, see Window instead. Windows are created via a constructor which takes a configuration object
that details the window's behaviour.WindowCore is an EventEmitter.
See WindowEvent for a list of events.
Static Methods
getCurrentWindow
Gets the current window object.
Arguments
callback [() => void]
Function that is called when the window is ready to be used (if newly created).
errorCallback [() => void]
Function that is called when the window wrapper could not be created.
Captures the current visible content for the given Window. Returns the image as a base64 encoded png string. Note: For the browser, this is limited by the usual cross-domain rules.
Returns
Promise<string>
A promise that resolves to a base64 encoded png
close
Tests
9/9
Electron
3/3
OpenFin
3/3
Browser
3/3
Closes the window. Only works on windows created via the ContainerJS API in the browser.
Returns
Promise<void>
A promise which resolves to nothing when the function has completed.
eventNames
Get all event names with active listeners.
Returns
Array<string | symbol>
focus
Focuses the window.
Returns
Promise<void>
A promise which resolves to nothing when the function has completed.
A promise that resolves to nothing when the option is set.
setPosition
Tests
3/3
Electron
1/1
OpenFin
1/1
Browser
1/1
Sets the windows position. Only works on windows created via the ContainerJS API in the browser.
Arguments
x [number]
The x position of the window.
y [number]
The y position of the window.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
setSize
Tests
3/3
Electron
1/1
OpenFin
1/1
Browser
1/1
Sets the width and height of the window. Only works on windows created via the ContainerJS API in the browser.
Arguments
width [number]
The width of the window.
height [number]
The height of the window.
Returns
Promise<void>
A promise that resolves to nothing when the option has been set.
app
Manage the ContainerJS application
Static Methods
ready
Wait until the API has bootstrapped before it is ready to use Note that some APIs may fail if the application tries to call
them before the API layer has finished bootstrapping.
Returns
Promise<any>
A promise that resolves when the API has finished bootstrapping.
setBadgeCount
Sets the counter badge for current app. Setting the count to 0 will hide the badge. This
is currently only supported in Electron on Mac and Linux.
Arguments
count [number]
the integer count for the app.
Returns
any
Display
Information about the user's display. Note that the Browser API does not support multiple
displays, so it assumes the display the browser is running in is the only display. The Screen class can be used to retrieve display information.
Properties
bounds
Bounds of the display.
id
Unique Id of the display.
primary
If the display is the primary display
rotation
Current rotation of the display, can be 0, 90, 180, 270.
scaleFactor
How much the display has been scaled.
NotificationOptions
Options that can be passed to the notification constructor
Properties
body
The text to display underneath the title text.
icon
The URL of an icon to be displayed in the notification.
image
The URL of an image to be displayed in the notification.
template
The URL of the notification template for OpenFin. Can be
relative to the current URL. Default: "template.html"
Position
Position of an object on screen
Properties
x
Horizontal position in pixels
y
Vertical position in pixels
Rectangle
Position and size of an object on screen
Properties
height
Height in pixels
width
Width in pixels
x
Horizontal position in pixels
y
Vertical position in pixels
WindowOptions
Options that can be passed to the window constructor
Properties
alwaysOnTop
Whether the window should always stay on top of other windows. Default is false.
backgroundColor
Window’s background color as Hexadecimal value.
center
Tests
2/2
Electron
1/1
OpenFin
1/1
Show window in the center of the screen.
child
Whether the window is a child of the current window. Default is false.
display
The id of the display to show the window on. If no id is passed in, the x and y position
of the window is relative to the primary monitor.
frame
If false, creates a frameless window. Default is true.
hasShadow
Whether window should have a shadow. This is only implemented on macOS. Default is true.
height
Tests
3/3
Electron
1/1
OpenFin
1/1
Browser
1/1
Window’s height in pixels.
maxHeight
Tests
2/2
Electron
1/1
OpenFin
1/1
Window’s maximum height.
maxWidth
Window’s maximum width.
maximizable
Whether window is maximizable. Default is true.
minHeight
Tests
2/2
Electron
1/1
OpenFin
1/1
Window’s minimum height.
minWidth
Window’s minimum width.
minimizable
Whether window is minimizable. Default is true.
name
Default window title.
resizable
Whether window is resizable. Default is true.
show
Whether window should be shown when created. Default is true.
skipTaskbar
Whether to show the window in taskbar. Default is false.