OSDN Git Service

update the dispatch method
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 14 Apr 2020 09:52:49 +0000 (17:52 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 14 Apr 2020 09:52:49 +0000 (17:52 +0800)
dapp-example/index.html
src/content.js

index e2d55e4..2978e4f 100644 (file)
@@ -23,8 +23,8 @@
       })
 
       // 监听Bytom插件加载成功事件
-      document.addEventListener('chromeBytomLoaded', () => {
-        console.log('chromeBytomLoaded')
+      document.addEventListener('bytomLoaded', () => {
+        console.log('bytomLoaded')
         bytom = window.bytom
       })
     </script>
index a64df11..241bda4 100644 (file)
@@ -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'))
     })