diff options
author | kumavis <kumavis@users.noreply.github.com> | 2016-10-13 04:52:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-13 04:52:32 +0800 |
commit | 8d5b2478e3aa939cb4b0a58b20b199cded62769e (patch) | |
tree | b287ae4a264fd29f5ec8b5fe2c97564fb80f62f8 /app/scripts/lib/auto-reload.js | |
parent | f68673e84ac48c5574b642b3b779d4d43954d98f (diff) | |
parent | 465cff78c33385c7f108e7539f484119f7a03767 (diff) | |
download | tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.tar tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.tar.gz tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.tar.bz2 tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.tar.lz tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.tar.xz tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.tar.zst tangerine-wallet-browser-8d5b2478e3aa939cb4b0a58b20b199cded62769e.zip |
Merge pull request #730 from MetaMask/i695-dapp-reload
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 |