Namespace: Platform

Platform

Manages the life cycle of windows and views in the application.

Enables taking snapshots of itself and applying them to restore a previous configuration as well as listen to platform events.

Namespaces

Layout

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) init(optionsopt) → {Promise.<void>}

EXPERIMENTAL

Initializes a Platform. Must be called from the Provider when using a custom provider.

Parameters:
Name Type Attributes Description
options InitPlatformOptions <optional>

platform options including a callback function that can be used to extend or replace default Provider behavior.

Tutorials:
Returns:
Type
Promise.<void>

(static) start(platformOptions) → {Promise.<Platform>}

Creates and starts a Platform and returns a wrapped and running Platform instance. 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>

(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.<View>}

Creates a new view and attaches it to a specified target window.

Parameters:
Name Type Attributes Description
viewOptions View~options

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.<View>

(async) createWindow(options) → {Promise.<_Window>}

Creates a new Window.

Parameters:
Name Type Description
options Window~options

Window creation options

Tutorials:
Returns:
Type
Promise.<_Window>

(async) fetchManifest(manifestUrl) → {Promise.<any>}

Fetches a JSON manifest using the browser process and returns a Javascript object. Can be overwritten using Platform.init.

Parameters:
Name Type Description
manifestUrl string

The URL of the manifest to fetch.

Tutorials:
Returns:
Type
Promise.<any>

(async) getSnapshot() → {Promise.<Snapshot>}

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.<Snapshot>

(async) getWindowContext(targetopt) → {Promise.<any>}

EXPERIMENTAL

Get the context context of a host window that was previously set using setWindowContext. The context will be saved in any platform snapshots. Returns a promise that resolves to the context.

Parameters:
Name Type Attributes Description
target Identity <optional>

A target window or view may optionally be provided. If no target is provided, target will be the current window (if called from a Window) or the current host window (if called from a View).

Tutorials:
Returns:
Type
Promise.<any>

(async) launchContentManifest(manifestUrl) → {Promise.<Platform>}

EXPERIMENTAL

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 that will be launched 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) quit() → {Promise.<void>}

Closes current platform, all its windows, and their views.

Tutorials:
Returns:
Type
Promise.<void>

(async) reparentView(viewIdentity, target) → {Promise.<View>}

DEPRECATED - please use Platform.createView. 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.<View>

(async) setWindowContext(context, targetopt) → {Promise.<void>}

EXPERIMENTAL

Set the context of a host window. The context will be available to the window itself, and to its child Views. It will be saved in any platform snapshots. It can be retrieved using getWindowContext.

Parameters:
Name Type Attributes Description
context any

A field where serializable context data can be stored to be saved in platform snapshots.

target Identity <optional>

A target window or view may optionally be provided. If no target is provided, the update will be applied to the current window (if called from a Window) or the current host window (if called from a View).

Tutorials:
Returns:
Type
Promise.<void>