diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-07-07 11:56:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-07 11:56:45 +0800 |
commit | e885c3ba09759354322677c75461aab0a35c999e (patch) | |
tree | e610aafe5dd65c1e2568a2a94d6eda4a6a072710 /app | |
parent | a038eed6e3fc678246bc880afb0dacf9defac8e2 (diff) | |
parent | d892fffce2c0a73139a4052030c3e93dc8af8d9a (diff) | |
download | tangerine-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')
-rw-r--r-- | app/scripts/contentscript.js | 6 | ||||
-rw-r--r-- | app/scripts/inpage.js | 5 |
2 files changed, 6 insertions, 5 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({ diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index e6f4078c8..f5e54cd7b 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -1,12 +1,11 @@ +/*global Web3*/ cleanContextForImports() -const Web3 = require('web3') +require('web3/dist/web3.min.js') const LocalMessageDuplexStream = require('./lib/local-message-stream.js') const setupDappAutoReload = require('./lib/auto-reload.js') const MetamaskInpageProvider = require('./lib/inpage-provider.js') restoreContextAfterImports() -// remove from window -delete window.Web3 // // setup plugin communication |