summaryrefslogtreecommitdiff
path: root/ext/bg/js/background-main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-24 14:01:21 -0400
committerGitHub <noreply@github.com>2020-05-24 14:01:21 -0400
commit6dd6af05e1ed3e0da4091af073c38e1d8ec0268d (patch)
tree7262add632fac645ca0481abbb63efb3b8291bb8 /ext/bg/js/background-main.js
parent3c4c82dcfc66a1b24a3df3d4b15283235c72cf66 (diff)
Update background global object usage (#556)
* Omit global window object for scripts used on the background page * Validate document exists before using * Remove dom.js from background.html
Diffstat (limited to 'ext/bg/js/background-main.js')
-rw-r--r--ext/bg/js/background-main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/bg/js/background-main.js b/ext/bg/js/background-main.js
index 24117f4e..345b4a77 100644
--- a/ext/bg/js/background-main.js
+++ b/ext/bg/js/background-main.js
@@ -20,6 +20,9 @@
*/
(async () => {
- window.yomichanBackend = new Backend();
- await window.yomichanBackend.prepare();
+ const backend = new Backend();
+ if (typeof window === 'object' && window !== null) {
+ window.yomichanBackend = backend;
+ }
+ await backend.prepare();
})();