From 4b3aa701b9a511f0a53840d712120a97c80efd27 Mon Sep 17 00:00:00 2001 From: Fabian Vogelsteller Date: Tue, 15 Sep 2015 15:52:57 +0200 Subject: [PATCH] add boolean to web3.reset() --- lib/web3.js | 4 ++-- lib/web3/requestmanager.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/web3.js b/lib/web3.js index 8ec99e5..bd3e4e9 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -109,8 +109,8 @@ web3.setProvider = function (provider) { web3.isConnected = function(){ return (this.currentProvider && this.currentProvider.isConnected()); }; -web3.reset = function () { - RequestManager.getInstance().reset(); +web3.reset = function (keepIsSyncing) { + RequestManager.getInstance().reset(keepIsSyncing); c.defaultBlock = 'latest'; c.defaultAccount = undefined; }; diff --git a/lib/web3/requestmanager.js b/lib/web3/requestmanager.js index e261481..db64295 100644 --- a/lib/web3/requestmanager.js +++ b/lib/web3/requestmanager.js @@ -177,11 +177,11 @@ RequestManager.prototype.stopPolling = function (pollId) { * * @method reset */ -RequestManager.prototype.reset = function () { +RequestManager.prototype.reset = function (keepIsSyncing) { for (var key in this.polls) { // remove all polls, except sync polls, // they need to be removed manually by calling syncing.stopWatching() - if(key.indexOf('syncPoll_') === -1) { + if(!keepIsSyncing || key.indexOf('syncPoll_') === -1) { this.polls[key].uninstall(); delete this.polls[key]; }