diff options
author | kumavis <aaron@kumavis.me> | 2016-10-13 03:35:55 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2016-10-13 03:35:55 +0800 |
commit | a1c3c944cf534fff8bfb9560347a03ba2a2bda00 (patch) | |
tree | 29888693645c9ad04f4b703f1fb0c0dfdac0da60 /app/scripts/lib/auto-reload.js | |
parent | 0182f8a4e91b8a9b0951967d2c075955bfb4f24f (diff) | |
download | tangerine-wallet-browser-a1c3c944cf534fff8bfb9560347a03ba2a2bda00.tar.gz tangerine-wallet-browser-a1c3c944cf534fff8bfb9560347a03ba2a2bda00.tar.zst tangerine-wallet-browser-a1c3c944cf534fff8bfb9560347a03ba2a2bda00.zip |
dapp reload - fixed disconnect detection via polling
Diffstat (limited to 'app/scripts/lib/auto-reload.js')
-rw-r--r-- | app/scripts/lib/auto-reload.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js index c4c8053f0..3c90905db 100644 --- a/app/scripts/lib/auto-reload.js +++ b/app/scripts/lib/auto-reload.js @@ -3,7 +3,7 @@ const ensnare = require('ensnare') module.exports = setupDappAutoReload -function setupDappAutoReload (web3, controlStream) { +function setupDappAutoReload (web3) { // export web3 as a global, checking for usage var pageIsUsingWeb3 = false var resetWasRequested = false @@ -16,19 +16,19 @@ function setupDappAutoReload (web3, controlStream) { global.web3 = web3 })) - // listen for reset requests from metamask - controlStream.once('data', function () { + return handleResetRequest + + function handleResetRequest() { resetWasRequested = true // ignore if web3 was not used if (!pageIsUsingWeb3) return // reload after short timeout - triggerReset() - }) - - // reload the page - function triggerReset () { - setTimeout(function () { - global.location.reload() - }, 500) + setTimeout(triggerReset, 500) } + } + +// reload the page +function triggerReset () { + global.location.reload() +}
\ No newline at end of file |