diff options
author | Vijay A <avijayr@protonmail.com> | 2021-09-08 19:27:23 +0530 |
---|---|---|
committer | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-08 19:49:43 +0530 |
commit | 7a446f7b8e9d4162d8e81eb863e151ef0ab66554 (patch) | |
tree | 2bd7794fb5080ad16d44420bc1f94ca2638435b7 /recipes/whatsapp/webview.js | |
parent | execute prepare script with npx to avoid missing husky dependency error (#676) (diff) | |
download | ferdium-recipes-7a446f7b8e9d4162d8e81eb863e151ef0ab66554.tar.gz ferdium-recipes-7a446f7b8e9d4162d8e81eb863e151ef0ab66554.tar.zst ferdium-recipes-7a446f7b8e9d4162d8e81eb863e151ef0ab66554.zip |
refactor: use the exposed methods for session handling from the main repo
Diffstat (limited to 'recipes/whatsapp/webview.js')
-rw-r--r-- | recipes/whatsapp/webview.js | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js index 8087b08..eaaf2c2 100644 --- a/recipes/whatsapp/webview.js +++ b/recipes/whatsapp/webview.js | |||
@@ -3,20 +3,8 @@ const _path = _interopRequireDefault(require('path')); | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | window.addEventListener('beforeunload', async () => { | 5 | window.addEventListener('beforeunload', async () => { |
6 | try { | 6 | Ferdi.clearStorageData(['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb']); |
7 | const { session } = Ferdi.getCurrentWebContents(); | 7 | Ferdi.releaseServiceWorkers(); |
8 | session.flushStorageData(); | ||
9 | session.clearStorageData({ | ||
10 | storages: ['appcache', 'serviceworkers', 'cachestorage', 'websql', 'indexdb'], | ||
11 | }); | ||
12 | const registrations = await window.navigator.serviceWorker.getRegistrations(); | ||
13 | registrations.forEach(r => { | ||
14 | r.unregister(); | ||
15 | console.log('ServiceWorker unregistered'); | ||
16 | }); | ||
17 | } catch (err) { | ||
18 | console.err(err); | ||
19 | } | ||
20 | }); | 8 | }); |
21 | 9 | ||
22 | module.exports = Ferdi => { | 10 | module.exports = Ferdi => { |