aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/contentscript.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-07-07 11:56:45 +0800
committerGitHub <noreply@github.com>2016-07-07 11:56:45 +0800
commite885c3ba09759354322677c75461aab0a35c999e (patch)
treee610aafe5dd65c1e2568a2a94d6eda4a6a072710 /app/scripts/contentscript.js
parenta038eed6e3fc678246bc880afb0dacf9defac8e2 (diff)
parentd892fffce2c0a73139a4052030c3e93dc8af8d9a (diff)
downloadtangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.tar
tangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.tar.gz
tangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.tar.bz2
tangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.tar.lz
tangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.tar.xz
tangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.tar.zst
tangerine-wallet-browser-e885c3ba09759354322677c75461aab0a35c999e.zip
Merge pull request #403 from MetaMask/fastinject
Improve web3 injection times
Diffstat (limited to 'app/scripts/contentscript.js')
-rw-r--r--app/scripts/contentscript.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index f4f064163..8b46f603c 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -1,14 +1,13 @@
const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
const PortStream = require('./lib/port-stream.js')
const ObjectMultiplex = require('./lib/obj-multiplex')
-// const urlUtil = require('url')
if (shouldInjectWeb3()) {
setupInjection()
+ setTimeout(setupStreams, 200)
}
function setupInjection(){
-
// inject in-page script
var scriptTag = document.createElement('script')
scriptTag.src = chrome.extension.getURL('scripts/inpage.js')
@@ -16,6 +15,9 @@ function setupInjection(){
var container = document.head || document.documentElement
// append as first child
container.insertBefore(scriptTag, container.children[0])
+}
+
+function setupStreams(){
// setup communication to page and plugin
var pageStream = new LocalMessageDuplexStream({