Tutorial: SnapshotSource.init

SnapshotSource.init

Initializes a SnapshotSource with custom getSnapshot and applySnapshot methods.

Example

const snapshotProvider = {
    async getSnapshot() { 
      const bounds = await fin.me.getBounds();
      return bounds;
     },
    async applySnapshot(snapshot) { 
      await fin.me.setBounds(snapshot);
      return undefined;
    }
}

await fin.SnapshotSource.init(snapshotProvider);