From 228a36bb638cfe152aab8bc6c6f4ad58de7e90ad Mon Sep 17 00:00:00 2001 From: Bowen Ding Date: Sat, 11 Apr 2020 22:44:52 +0800 Subject: [PATCH] Fix password prompt disappearing instantly by delaying service worker setup until window load --- sigal/plugins/encrypt/static/decrypt.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sigal/plugins/encrypt/static/decrypt.js b/sigal/plugins/encrypt/static/decrypt.js index e5ee06a..6618cde 100644 --- a/sigal/plugins/encrypt/static/decrypt.js +++ b/sigal/plugins/encrypt/static/decrypt.js @@ -40,7 +40,11 @@ class Decryptor { if (local_config) { this._config = local_config; } - this._mSetupServiceWorker(); + window.addEventListener( + "load", + (e) => this._mSetupServiceWorker(), + { once: true, passive: true } + ); } console.info("Decryptor initialized");