Tutorial: SnapshotSource.ready

SnapshotSource.ready

Resolves when the target SnapshotSource has been initialized.

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