aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/contentscript.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-07-07 11:20:40 +0800
committerkumavis <aaron@kumavis.me>2016-07-07 11:20:40 +0800
commit7aa120e630fcc7910114ba825c015a602a3b9403 (patch)
tree87095af967c1f0d44bf2d66fbb324309d8c441db /app/scripts/contentscript.js
parent9d54f10dc5bd42f9103ff6c9f2094d5af81b2342 (diff)
downloadtangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.tar
tangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.tar.gz
tangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.tar.bz2
tangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.tar.lz
tangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.tar.xz
tangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.tar.zst
tangerine-wallet-browser-7aa120e630fcc7910114ba825c015a602a3b9403.zip
web3 injection - use web3 dist for faster injection
Diffstat (limited to 'app/scripts/contentscript.js')
-rw-r--r--app/scripts/contentscript.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index f4f064163..44cac3b0a 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,13 @@ function setupInjection(){
var container = document.head || document.documentElement
// append as first child
container.insertBefore(scriptTag, container.children[0])
+}
+
+function setupStreams(){
+
+ const LocalMessageDuplexStream = require('./lib/local-message-stream.js')
+ const PortStream = require('./lib/port-stream.js')
+ const ObjectMultiplex = require('./lib/obj-multiplex')
// setup communication to page and plugin
var pageStream = new LocalMessageDuplexStream({