AboutSupportDeveloper GuideVersion 36.122.80.23

Class SnapshotSource<Snapshot>

Enables configuring a SnapshotSource with custom getSnapshot and applySnapshot methods.

Type Parameters

  • Snapshot = unknown

    Implementation-defined shape of an application snapshot. Allows custom snapshot implementations for legacy applications to define their own snapshot format.

Hierarchy

  • Base
    • SnapshotSource

Accessors

  • get me(): Identity
  • Provides access to the OpenFin representation of the current code context (usually a document such as a View or Window), as well as to the current Interop context.

    Useful for debugging in the devtools console, where this will intelligently type itself based on the context in which the devtools panel was opened.

    Returns Identity

Methods

  • Call the SnapshotSource's applySnapshot method defined by init.

    Parameters

    • snapshot: Snapshot

    Returns Promise<void>

  • Call the SnapshotSource's getSnapshot method defined by init.

    Returns Promise<Snapshot>

  • Method to determine if the SnapshotSource has been initialized.

    Returns Promise<void>

    Remarks

    Use when the parent application is starting up to ensure the SnapshotSource is able to accept and apply a snapshot using the applySnapshot method.

    Example

    let snapshotSource = fin.SnapshotSource.wrapSync(fin.me);

    const snapshotProvider = {
    async getSnapshot() { return 'foo' },
    async applySnapshot(snapshot) {
    console.log(snapshot);
    return undefined;
    }
    }
    await fin.SnapshotSource.init(snapshotProvider);

    try {
    await snapshotSource.ready();
    await snapshotSource.applySnapshot('foo');
    } catch (err) {
    console.log(err)
    }