Methods
(async, static) getCurrent() → {Promise.<Platform>}
Asynchronously returns a Platform object that represents the current platform.
- Tutorials:
Returns:
- Type
- Promise.<Platform>
(static) getCurrentSync() → {Platform}
Synchronously returns a Platform object that represents the current platform.
- Tutorials:
Returns:
- Type
- Platform
(async, static) start(platformOptions) → {Promise.<Platform>}
Creates and starts a Platform and returns a wrapped and running Platform. The wrapped Platform methods can be used to launch content into the platform. Promise will reject if the platform is already running.
Parameters:
Name | Type | Description |
---|---|---|
platformOptions |
PlatformOptions |
- Tutorials:
Returns:
- Type
- Promise.<Platform>
(async, static) startFromManifest(manifestUrl, optsopt) → {Promise.<Platform>}
Retrieves platforms's manifest and returns a wrapped and running Platform. If there is a snapshot in the manifest, it will be launched into the platform.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
manifestUrl |
string | The URL of platform's manifest. |
|
opts |
RvmLaunchOptions |
<optional> |
Parameters that the RVM will use. |
- Tutorials:
Returns:
- Type
- Promise.<Platform>
(async, static) wrap(identity) → {Promise.<Platform>}
Asynchronously returns a Platform object that represents an existing platform.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity |
- Tutorials:
Returns:
- Type
- Promise.<Platform>
(static) wrapSync(identity) → {Platform}
Synchronously returns a Platform object that represents an existing platform.
Parameters:
Name | Type | Description |
---|---|---|
identity |
Identity |
- Tutorials:
Returns:
- Type
- Platform
(async) applySnapshot(requestedSnapshot, optionsopt) → {Promise.<Platform>}
Adds a snapshot to a running Platform.
Can optionally close existing windows and overwrite current platform state with that of a snapshot.
The function accepts either a snapshot taken using getSnapshot, or a url or filepath to a snapshot JSON object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
requestedSnapshot |
Snapshot | string | Snapshot to apply, or a url or filepath. |
|
options |
ApplySnapshotOptions |
<optional> |
Optional parameters to specify whether existing windows should be closed. |
- Tutorials:
Returns:
- Type
- Promise.<Platform>
(async) closeView(viewIdentity) → {Promise.<void>}
Closes a specified view in a target window.
Parameters:
Name | Type | Description |
---|---|---|
viewIdentity |
Identity | View identity |
- Tutorials:
Returns:
- Type
- Promise.<void>
(async) createView(viewOptions, targetopt) → {Promise.<Identity>}
Creates a new view and attaches it to a specified target window.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
viewOptions |
ViewCreationOptions | View creation options |
|
target |
Identity |
<optional> |
The window to which the new view is to be attached. If no target, create a view in a new window. |
- Tutorials:
Returns:
- Type
- Promise.<Identity>
(async) createWindow(options) → {Promise.<Identity>}
Creates a new Window.
Parameters:
Name | Type | Description |
---|---|---|
options |
Window~options | Window creation options |
- Tutorials:
Returns:
- Type
- Promise.<Identity>
(async) getContext() → {Promise.<any>}
Get the context of your current window or view environment that was previously set using setContext. The context will be saved in any platform snapshots. Returns a promise that resolves to the context.
- Tutorials:
Returns:
- Type
- Promise.<any>
(async) getSnapshot() → {Promise.<any>}
Returns a snapshot of the platform in its current state.
Can be used to restore an application to a previous state.
- Tutorials:
Returns:
- Type
- Promise.<any>
(async) launchLegacyManifest(manifestUrl) → {Promise.<Platform>}
Retrieves a manifest by url and launches a legacy application manifest or snapshot into the platform. Returns a promise that resolves to the wrapped Platform.
Parameters:
Name | Type | Description |
---|---|---|
manifestUrl |
string | The URL of the manifest of the app to launch into the platform. If this app manifest contains a snapshot, that will be launched into the platform. If not, the application described in startup_app options will be launched into the platform. The applicable startup_app options will become View Options. |
- Tutorials:
Returns:
- Type
- Promise.<Platform>
(async) onWindowContextUpdate() → {Promise.<boolean>}
Set a listener to be executed when the when a View's target Window experiences a context update. Can only be set from a view that has wrapped it's current platform. The listener receives the new context as its first argument and the previously context as the second argument. If the listener returns a truthy value, the View's context will be updated with the new context as if setContext was called. This can only be set once per javascript environment (once per View), and any subsequent calls to onWindowContextUpdate will error out. If the listener is successfully set, returns a promise that resolves to true.
- Tutorials:
Returns:
- Type
- Promise.<boolean>
(async) quit() → {Promise.<void>}
Closes current platform, all its windows, and their views.
- Tutorials:
Returns:
- Type
- Promise.<void>
(async) reparentView(viewIdentity, target) → {Promise.<Identity>}
Reparents a specified view in a new target window.
Parameters:
Name | Type | Description |
---|---|---|
viewIdentity |
Identity | View identity |
target |
Identity | new owner window identity |
- Tutorials:
Returns:
- Type
- Promise.<Identity>
(async) setContext(context) → {Promise.<void>}
Set the context of your current window or view environment. The context will be saved in any platform snapshots.
Parameters:
Name | Type | Description |
---|---|---|
context |
any | A field where serializable context data can be stored to be saved in platform snapshots. |
- Tutorials:
Returns:
- Type
- Promise.<void>