Tutorial: PlatformProvider.applySnapshot

PlatformProvider.applySnapshot

Allows overriding a platform's default snapshot behavior. All calls to Platform.applySnapshot will pass through the override.

Example

const overrideCallback = (Provider) => {
    class Override extends Provider {
        async applySnapshot(payload, callerIdentity) {
            const { snapshot, options } = payload;
            // Perhaps in our platform, we wish to always use the closeExistingWindows option
            return super.applySnapshot(
                { snapshot, options: { ...options, closeExistingWindows: true }},
                callerIdentity
            );
    }
    return new Override();
}

fin.Platform.init({ overrideCallback });