|
|
@ -2,8 +2,8 @@ |
|
|
|
cleanContextForImports() |
|
|
|
cleanContextForImports() |
|
|
|
require('web3/dist/web3.min.js') |
|
|
|
require('web3/dist/web3.min.js') |
|
|
|
const LocalMessageDuplexStream = require('post-message-stream') |
|
|
|
const LocalMessageDuplexStream = require('post-message-stream') |
|
|
|
const PingStream = require('ping-pong-stream/ping') |
|
|
|
// const PingStream = require('ping-pong-stream/ping')
|
|
|
|
const endOfStream = require('end-of-stream') |
|
|
|
// const endOfStream = require('end-of-stream')
|
|
|
|
const setupDappAutoReload = require('./lib/auto-reload.js') |
|
|
|
const setupDappAutoReload = require('./lib/auto-reload.js') |
|
|
|
const MetamaskInpageProvider = require('./lib/inpage-provider.js') |
|
|
|
const MetamaskInpageProvider = require('./lib/inpage-provider.js') |
|
|
|
restoreContextAfterImports() |
|
|
|
restoreContextAfterImports() |
|
|
@ -40,13 +40,14 @@ reloadStream.once('data', triggerReload) |
|
|
|
|
|
|
|
|
|
|
|
// setup ping timeout autoreload
|
|
|
|
// setup ping timeout autoreload
|
|
|
|
// LocalMessageDuplexStream does not self-close, so reload if pingStream fails
|
|
|
|
// LocalMessageDuplexStream does not self-close, so reload if pingStream fails
|
|
|
|
var pingChannel = inpageProvider.multiStream.createStream('pingpong') |
|
|
|
// var pingChannel = inpageProvider.multiStream.createStream('pingpong')
|
|
|
|
var pingStream = new PingStream({ objectMode: true }) |
|
|
|
// var pingStream = new PingStream({ objectMode: true })
|
|
|
|
// wait for first successful reponse
|
|
|
|
// wait for first successful reponse
|
|
|
|
metamaskStream.once('data', function(){ |
|
|
|
// disable pingStream until https://github.com/MetaMask/metamask-plugin/issues/746 is resolved more gracefully
|
|
|
|
pingStream.pipe(pingChannel).pipe(pingStream) |
|
|
|
// metamaskStream.once('data', function(){
|
|
|
|
}) |
|
|
|
// pingStream.pipe(pingChannel).pipe(pingStream)
|
|
|
|
endOfStream(pingStream, triggerReload) |
|
|
|
// })
|
|
|
|
|
|
|
|
// endOfStream(pingStream, triggerReload)
|
|
|
|
|
|
|
|
|
|
|
|
// set web3 defaultAcount
|
|
|
|
// set web3 defaultAcount
|
|
|
|
inpageProvider.publicConfigStore.subscribe(function (state) { |
|
|
|
inpageProvider.publicConfigStore.subscribe(function (state) { |
|
|
|