Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
});
};
DelegateComponent.prototype.watchForSourceClose = function watchForSourceClose(source) {
var _this2 = this;
var closeSourceWindowListener = onCloseWindow(source, function () {
return _this2.destroy();
}, 3000);
this.clean.register('destroyCloseSourceWindowListener', closeSourceWindowListener.cancel);
};
watchForSourceClose(source : CrossDomainWindowType) {
const closeSourceWindowListener = onCloseWindow(source, () => this.destroy(), 3000);
this.clean.register(closeSourceWindowListener.cancel);
}
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);
});
}
watchForClose() {
window.addEventListener('beforeunload', () => {
this.parent.checkClose.fireAndForget();
});
window.addEventListener('unload', () => {
this.parent.checkClose.fireAndForget();
});
onCloseWindow(this.parentComponentWindow, () => {
this.destroy();
});
}