Skip to content

Commit

Permalink
perf: update neuron-web start time
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Dec 16, 2018
1 parent 50170c1 commit 8b42137
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions packages/neuron-web/public/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,20 @@ window.addMessenger = (sdk) => {
}

const neuronWebReadyEvent = new Event("neuronWebReady")
window.dispatchEvent(neuronWebReadyEvent)

// Fuer die schwach app
if (window.localStorage.getItem('DISABLE_NEURON_WEB_AUTO_IMPORT')) {
window.dispatchEvent(neuronWebReadyEvent)
// if (window.localStorage.getItem('DISABLE_NEURON_WEB_AUTO_IMPORT')) {
// window.dispatchEvent(neuronWebReadyEvent)

} else {
window.addEventListener("neuronWebReady", () => {
window.console.log("NeuronWebReady")
if (window.nervos || window.appchain) {
window.addMessenger(window.nervos || window.appchain)
}
})
setTimeout(() => {
window.dispatchEvent(neuronWebReadyEvent)
}, 1000)
}
// } else {
// window.addEventListener("neuronWebReady", () => {
// window.console.log("NeuronWebReady")
// if (window.nervos || window.appchain) {
// window.addMessenger(window.nervos || window.appchain)
// }
// })
// setTimeout(() => {
// window.dispatchEvent(neuronWebReadyEvent)
// }, 1000)
// }
2 changes: 1 addition & 1 deletion packages/neuron-web/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"bundle.js",
"contentscript.js"
],
"run_at": "document_end"
"run_at": "document_start"
}],
"web_accessible_resources": ["/bundle.js", "/inject.js"]
}

0 comments on commit 8b42137

Please sign in to comment.