diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-01 15:19:21 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-01 15:19:21 -0500 |
commit | a7e4901f728ac3069d9ae6a185b44971178a10a0 (patch) | |
tree | 8cfcf107e1cf74e6c44f9ebba8c84749fbfb902c /ext/bg/js/settings.js | |
parent | 403b86675d288a8082125475f87f9b1740e3480a (diff) |
Move PageExitPrevention to its own file
Diffstat (limited to 'ext/bg/js/settings.js')
-rw-r--r-- | ext/bg/js/settings.js | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/ext/bg/js/settings.js b/ext/bg/js/settings.js index abe6f389..9e9604e2 100644 --- a/ext/bg/js/settings.js +++ b/ext/bg/js/settings.js @@ -223,52 +223,6 @@ $(document).ready(() => onReady()); /* - * Page exit prevention - */ - -class PageExitPrevention { - constructor() { - } - - start() { - PageExitPrevention._addInstance(this); - } - - end() { - PageExitPrevention._removeInstance(this); - } - - static _addInstance(instance) { - const size = PageExitPrevention._instances.size; - PageExitPrevention._instances.set(instance, true); - if (size === 0) { - window.addEventListener('beforeunload', PageExitPrevention._onBeforeUnload); - } - } - - static _removeInstance(instance) { - if ( - PageExitPrevention._instances.delete(instance) && - PageExitPrevention._instances.size === 0 - ) { - window.removeEventListener('beforeunload', PageExitPrevention._onBeforeUnload); - } - } - - static _onBeforeUnload(e) { - if (PageExitPrevention._instances.size === 0) { - return; - } - - e.preventDefault(); - e.returnValue = ''; - return ''; - } -} -PageExitPrevention._instances = new Map(); - - -/* * Appearance */ |