Methods
addView(payload, identity) → {Promise.<void>}
Add a view to the target window. If the view does not exist yet, it will be created.
Parameters:
Name | Type | Description |
---|---|---|
payload |
CreateViewPayload | Contains two properties: |
identity |
Identity | Identity of the entity that called Platform.addView.
Undefined if |
Returns:
- Type
- Promise.<void>
(async) applySnapshot(payload, identityopt) → {Promise.<void>}
Handles requests to apply a snapshot to the current Platform.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
payload |
ApplySnapshotPayload | Payload containing the snapshot to be applied, as well as any options. |
|
identity |
Identity |
<optional> |
Identity of the entity that called Platform.applySnapshot. Undefined if called internally (e.g. when opening the initial snapshot). |
Returns:
- Type
- Promise.<void>
(async) closeView(payload, identity)
Closes a view
Parameters:
Name | Type | Description |
---|---|---|
payload |
CloseViewPayload | Specifies the |
identity |
Identity | Identity of the entity that called Platform.closeView. |
createView(payload, identity) → {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. |
identity |
Identity | Identity of the entity that called Platform.createView. |
Returns:
- Type
- Promise.<void>
(async) createWindow(payload, identityopt)
Handles requests to create a window in the current platform.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
payload |
WindowOption | Window options for the window to be created. |
|
identity |
Identity |
<optional> |
If Platform.createWindow was called, the identity of the caller will be here.
If |
(async) getSnapshot(payload, identity) → {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 |
identity |
Identity | Identity of the entity that called Platform.getSnapshot. |
Returns:
Snapshot of current platform state.
- Type
- Promise.<Snapshot>
(async) getWindowContext(payload, identityopt) → {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 | Attributes | Description |
---|---|---|---|
payload |
GetWindowContextPayload | Object containing the requested |
|
identity |
Identity |
<optional> |
Identity of the entity that called Platform.getWindowContext.
Undefined when |
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. |
Returns:
An array of WindowOptions with their position modified to fit on screen.
- Type
- Promise.<Array.<WindowOptions>>
quit(payload, identity) → {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. |
identity |
Identity | Identity of the entity that called Platform.quit. |
Returns:
- Type
- Promise.<void>
(async) replaceLayout(payload, identityopt) → {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 | Attributes | Description |
---|---|---|---|
payload |
ReplaceLayoutPayload | Contains the |
|
identity |
Identity |
<optional> |
Identity of the entity that called Platform.replaceLayout.
Undefined if |
Returns:
- Type
- Promise.<void>
(async) setWindowContext(payload, identityopt) → {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 | Attributes | Description |
---|---|---|---|
payload |
SetWindowContextPayload | Object containing the requested |
|
identity |
Identity |
<optional> |
Identity of the entity that called Platform.setWindowContext.
Undefined if |
Returns:
The new context.
- Type
- Promise.<any>