aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/background-main.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/background-main.js')
-rw-r--r--ext/bg/js/background-main.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/bg/js/background-main.js b/ext/bg/js/background-main.js
index 24117f4e..9dd447c4 100644
--- a/ext/bg/js/background-main.js
+++ b/ext/bg/js/background-main.js
@@ -17,9 +17,15 @@
/* global
* Backend
+ * BackendEventHandler
*/
-(async () => {
- window.yomichanBackend = new Backend();
- await window.yomichanBackend.prepare();
+(() => {
+ const backend = new Backend();
+ const backendEventHandler = new BackendEventHandler(backend);
+ backendEventHandler.prepare();
+ if (typeof window === 'object' && window !== null) {
+ window.yomichanBackend = backend;
+ }
+ backend.prepare();
})();