How to use the cross-domain-utils/src.onCloseWindow function in cross-domain-utils

To help you get started, we’ve selected a few cross-domain-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github krakenjs / zoid / dist / module / component / parent / index.js View on Github external
return proxyWin.awaitWindow().then(function (win) {
            var closeWindowListener = onCloseWindow(win, function () {
                _this12.component.log('detect_close_child');

                return ZalgoPromise['try'](function () {
                    return _this12.props.onClose(CLOSE_REASONS.CLOSE_DETECTED);
                })['finally'](function () {
                    return _this12.destroy();
                });
            }, 3000);

            _this12.clean.register('destroyCloseWindowListener', closeWindowListener.cancel);
        });
    };
github krakenjs / zoid / dist / module / component / delegate / index.js View on Github external
DelegateComponent.prototype.watchForSourceClose = function watchForSourceClose(source) {
        var _this2 = this;

        var closeSourceWindowListener = onCloseWindow(source, function () {
            return _this2.destroy();
        }, 3000);
        this.clean.register('destroyCloseSourceWindowListener', closeSourceWindowListener.cancel);
    };
github krakenjs / zoid / src / delegate / index.js View on Github external
watchForSourceClose(source : CrossDomainWindowType) {
        const closeSourceWindowListener = onCloseWindow(source, () => this.destroy(), 3000);
        this.clean.register(closeSourceWindowListener.cancel);
    }
github krakenjs / zoid / src / component / parent / index.js View on Github external
return proxyWin.awaitWindow().then(win => {
            let closeWindowListener = onCloseWindow(win, () => {
                this.component.log(`detect_close_child`);

                return ZalgoPromise.try(() => {
                    return this.props.onClose(CLOSE_REASONS.CLOSE_DETECTED);
                }).finally(() => {
                    return this.destroy();
                });
            }, 3000);

            this.clean.register('destroyCloseWindowListener', closeWindowListener.cancel);
        });
    }
github krakenjs / zoid / src / child / index.js View on Github external
watchForClose() {
        window.addEventListener('beforeunload', () => {
            this.parent.checkClose.fireAndForget();
        });

        window.addEventListener('unload', () => {
            this.parent.checkClose.fireAndForget();
        });

        onCloseWindow(this.parentComponentWindow, () => {
            this.destroy();
        });
    }