Tutorial: PlatformProvider.createWindow


Allows overriding a platform's default window creation behavior. All calls to Platform.createWindow will pass through the override.


const overrideCallback = (PlatformProvider) => {
    class Override extends PlatformProvider {
        async createWindow(options, callerIdentity) {
            if (options.reason === 'tearout') {
                // Perhaps in our platform, we want tearout windows to have a certain initial context value
                const customContext = {
                    security: 'STOCK',
                    currentView: 'detailed'
                return super.createWindow({ ...options, customContext }, callerIdentity);
            // default behavior for all other creation reasons
            return super.createWindow(options, callerIdentity);
    return new Override();

fin.Platform.init({ overrideCallback });