aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/auto-reload.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/auto-reload.js')
-rw-r--r--app/scripts/lib/auto-reload.js15
1 files changed, 6 insertions, 9 deletions
diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js
index 95a744b2c..b45f02009 100644
--- a/app/scripts/lib/auto-reload.js
+++ b/app/scripts/lib/auto-reload.js
@@ -3,13 +3,11 @@ const ensnare = require('./ensnare.js')
module.exports = setupDappAutoReload
-
-function setupDappAutoReload(web3, controlStream){
-
+function setupDappAutoReload (web3, controlStream) {
// export web3 as a global, checking for usage
var pageIsUsingWeb3 = false
var resetWasRequested = false
- global.web3 = ensnare(web3, once(function(){
+ global.web3 = ensnare(web3, once(function () {
// if web3 usage happened after a reset request, trigger reset late
if (resetWasRequested) return triggerReset()
// mark web3 as used
@@ -19,7 +17,7 @@ function setupDappAutoReload(web3, controlStream){
}))
// listen for reset requests from metamask
- controlStream.once('data', function(){
+ controlStream.once('data', function () {
resetWasRequested = true
// ignore if web3 was not used
if (!pageIsUsingWeb3) return
@@ -28,10 +26,9 @@ function setupDappAutoReload(web3, controlStream){
})
// reload the page
- function triggerReset(){
- setTimeout(function(){
+ function triggerReset () {
+ setTimeout(function () {
global.location.reload()
}, 500)
}
-
-} \ No newline at end of file
+}