From 4b1caf6447231b093f65d9b6fb5561faa22d4a28 Mon Sep 17 00:00:00 2001 From: Zhiting Lin Date: Tue, 14 Apr 2020 17:52:49 +0800 Subject: [PATCH] update the dispatch method --- dapp-example/index.html | 4 ++-- src/content.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dapp-example/index.html b/dapp-example/index.html index e2d55e4..2978e4f 100644 --- a/dapp-example/index.html +++ b/dapp-example/index.html @@ -23,8 +23,8 @@ }) // 监听Bytom插件加载成功事件 - document.addEventListener('chromeBytomLoaded', () => { - console.log('chromeBytomLoaded') + document.addEventListener('bytomLoaded', () => { + console.log('bytomLoaded') bytom = window.bytom }) diff --git a/src/content.js b/src/content.js index a64df11..241bda4 100644 --- a/src/content.js +++ b/src/content.js @@ -45,6 +45,7 @@ class Content { // Dispatching the loaded event to the web application. isReady = true + document.dispatchEvent(new CustomEvent('bytomLoaded')) document.dispatchEvent(new CustomEvent('chromeBytomLoaded')) }) -- 2.11.0