Methods
(async) applySnapshot(payload, callerIdentity) → {Promise.<void>}
Handles requests to apply a snapshot to the current Platform.
Parameters:
Name | Type | Description |
---|---|---|
payload |
ApplySnapshotPayload | Payload containing the snapshot to be applied, as well as any options. |
callerIdentity |
Identity | Identity of the entity that called
Platform.applySnapshot.
If called internally (e.g. when opening the initial snapshot),
|
- Tutorials:
Returns:
- Type
- Promise.<void>
(async) closeView(payload, callerIdentity)
Closes a view
Parameters:
Name | Type | Description |
---|---|---|
payload |
CloseViewPayload | Specifies the |
callerIdentity |
Identity | Identity of the entity that called Platform.closeView. |
- Tutorials:
(async) createView(payload, callerIdentity) → {Promise.<void>}
Creates a new view and attaches it to a specified target window.
Parameters:
Name | Type | Description |
---|---|---|
payload |
CreateViewPayload | Creation options for the new view. |
callerIdentity |
Identity | Identity of the entity that called Platform.createView. |
Returns:
- Type
- Promise.<void>
(async) createWindow(payload, callerIdentity)
Handles requests to create a window in the current platform.
Parameters:
Name | Type | Description |
---|---|---|
payload |
WindowOption | Window options for the window to be created. |
callerIdentity |
Identity | If Platform.createWindow
was called, the identity of the caller will be here.
If |
- Tutorials:
(async) getSnapshot(payload, callerIdentity) → {Promise.<Snapshot>}
Gets the current state of windows and their views and returns a snapshot object containing that info.
Parameters:
Name | Type | Description |
---|---|---|
payload |
undefined | Undefined unless you've defined a custom |
callerIdentity |
Identity | Identity of the entity that called Platform.getSnapshot. |
- Tutorials:
Returns:
Snapshot of current platform state.
- Type
- Promise.<Snapshot>
(async) getWindowContext(payload, callerIdentity) → {Promise.<any>}
Handles requests to get a window's context. target
may be a window or a view.
If it is a window, that window's customContext
will be returned.
If it is a view, the customContext
of that view's current host window will be returned.
Parameters:
Name | Type | Description |
---|---|---|
payload |
GetWindowContextPayload | Object containing the requested |
callerIdentity |
Identity | Identity of the entity that called
Platform.getWindowContext.
If |
- Tutorials:
Returns:
The new context.
- Type
- Promise.<any>
(async) onWindowContextUpdated(payload) → {Promise.<HostContextChangedPayload>}
Called when a window's customContext
is updated.
Responsible for raising the host-context-updated
event on that window's child views.
Parameters:
Name | Type | Description |
---|---|---|
payload |
WindowOptionsChangedEvent.<'window', 'options-changed'> | The event payload for the window
whose context has changed.
The new context will be contained as |
Returns:
The event that it raised.
- Type
- Promise.<HostContextChangedPayload>
(async) positionOutOfBoundsWindows(snapshot, outOfBoundsWindows) → {Promise.<Array.<WindowOptions>>}
Called when a snapshot is being applied and some windows in that snapshot would be fully or partially off-screen. Returns an array of windows with modified positions,such that any off-screen windows are positioned in the top left corner of the main monitor.
Parameters:
Name | Type | Description |
---|---|---|
snapshot |
Snapshot | The snapshot to be applied. |
outOfBoundsWindows |
Array.<WindowOptions> | An array of WindowOptions for any windows that would be off-screen. |
- Tutorials:
Returns:
An array of WindowOptions with their position modified to fit on screen.
- Type
- Promise.<Array.<WindowOptions>>
quit(payload, callerIdentity) → {Promise.<void>}
Closes the current Platform and all child windows and views.
Parameters:
Name | Type | Description |
---|---|---|
payload |
undefined | Undefined unless you have implemented a custom quite protocol. |
callerIdentity |
Identity | Identity of the entity that called Platform.quit.
If called in response to the last window in a platform closing, |
- Tutorials:
Returns:
- Type
- Promise.<void>
(async) replaceLayout(payload, callerIdentity) → {Promise.<void>}
Replaces a Platform window's layout with a new layout. Any views that were in the old layout but not the new layout will be destroyed.
Parameters:
Name | Type | Description |
---|---|---|
payload |
ReplaceLayoutPayload | Contains the |
callerIdentity |
Identity | Identity of the entity that called
Platform.replaceLayout.
If |
- Tutorials:
Returns:
- Type
- Promise.<void>
(async) setWindowContext(payload, callerIdentity) → {Promise.<any>}
Handles requests to set a window's context. target
may be a window or a view.
If it is a window, that window's customContext
will be updated.
If it is a view, the customContext
of that view's current host window will be updated.
Parameters:
Name | Type | Description |
---|---|---|
payload |
SetWindowContextPayload | Object containing the requested |
callerIdentity |
Identity | Identity of the entity that called
Platform.setWindowContext.
If |
- Tutorials:
Returns:
The new context.
- Type
- Promise.<any>