AboutSupportDeveloper GuideVersion 40.128.82.13

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
  • Returns Identity

    me should only be accessed from the fin global (FinApi.me); access through entity classes is not guaranteed to behave sensibly in all calling contexts.

Methods

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

    Parameters

    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>

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

    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)
    }