common fixes in requestmanager

This commit is contained in:
Marek Kotewicz 2015-06-15 07:00:38 +02:00
parent 47e292a12c
commit 4228b02cd0
6 changed files with 25 additions and 37 deletions

18
dist/web3-light.js vendored
View File

@ -3872,7 +3872,7 @@ RequestManager.prototype.sendBatch = function (data, callback) {
RequestManager.prototype.setProvider = function (p) {
this.provider = p;
if(this.provider && !this.isPolling) {
if (this.provider && !this.isPolling) {
this.poll();
this.isPolling = true;
}
@ -3913,9 +3913,7 @@ RequestManager.prototype.stopPolling = function (pollId) {
*/
RequestManager.prototype.reset = function () {
for (var key in this.polls) {
if (this.polls.hasOwnProperty(key)) {
this.polls[key].uninstall();
}
this.polls[key].uninstall();
}
this.polls = {};
@ -3935,7 +3933,7 @@ RequestManager.prototype.poll = function () {
/*jshint maxcomplexity: 6 */
this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);
if (this.polls === {}) {
if (Object.keys(this.polls).length === 0) {
return;
}
@ -3947,10 +3945,8 @@ RequestManager.prototype.poll = function () {
var pollsData = [];
var pollsKeys = [];
for (var key in this.polls) {
if (this.polls.hasOwnProperty(key)) {
pollsData.push(this.polls[key].data);
pollsKeys.push(key);
}
pollsData.push(this.polls[key].data);
pollsKeys.push(key);
}
if (pollsData.length === 0) {
@ -3973,13 +3969,13 @@ RequestManager.prototype.poll = function () {
results.map(function (result, index) {
var key = pollsKeys[index];
// make sure the filter is still installed after arrival of the request
if(self.polls[key]) {
if (self.polls[key]) {
result.callback = self.polls[key].callback;
return result;
} else
return false;
}).filter(function (result) {
return (!result) ? false : true;
return !!result;
}).filter(function (result) {
var valid = Jsonrpc.getInstance().isValidResponse(result);
if (!valid) {

File diff suppressed because one or more lines are too long

18
dist/web3.js vendored
View File

@ -3872,7 +3872,7 @@ RequestManager.prototype.sendBatch = function (data, callback) {
RequestManager.prototype.setProvider = function (p) {
this.provider = p;
if(this.provider && !this.isPolling) {
if (this.provider && !this.isPolling) {
this.poll();
this.isPolling = true;
}
@ -3913,9 +3913,7 @@ RequestManager.prototype.stopPolling = function (pollId) {
*/
RequestManager.prototype.reset = function () {
for (var key in this.polls) {
if (this.polls.hasOwnProperty(key)) {
this.polls[key].uninstall();
}
this.polls[key].uninstall();
}
this.polls = {};
@ -3935,7 +3933,7 @@ RequestManager.prototype.poll = function () {
/*jshint maxcomplexity: 6 */
this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);
if (this.polls === {}) {
if (Object.keys(this.polls).length === 0) {
return;
}
@ -3947,10 +3945,8 @@ RequestManager.prototype.poll = function () {
var pollsData = [];
var pollsKeys = [];
for (var key in this.polls) {
if (this.polls.hasOwnProperty(key)) {
pollsData.push(this.polls[key].data);
pollsKeys.push(key);
}
pollsData.push(this.polls[key].data);
pollsKeys.push(key);
}
if (pollsData.length === 0) {
@ -3973,13 +3969,13 @@ RequestManager.prototype.poll = function () {
results.map(function (result, index) {
var key = pollsKeys[index];
// make sure the filter is still installed after arrival of the request
if(self.polls[key]) {
if (self.polls[key]) {
result.callback = self.polls[key].callback;
return result;
} else
return false;
}).filter(function (result) {
return (!result) ? false : true;
return !!result;
}).filter(function (result) {
var valid = Jsonrpc.getInstance().isValidResponse(result);
if (!valid) {

4
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -141,7 +141,7 @@ RequestManager.prototype.sendBatch = function (data, callback) {
RequestManager.prototype.setProvider = function (p) {
this.provider = p;
if(this.provider && !this.isPolling) {
if (this.provider && !this.isPolling) {
this.poll();
this.isPolling = true;
}
@ -182,9 +182,7 @@ RequestManager.prototype.stopPolling = function (pollId) {
*/
RequestManager.prototype.reset = function () {
for (var key in this.polls) {
if (this.polls.hasOwnProperty(key)) {
this.polls[key].uninstall();
}
this.polls[key].uninstall();
}
this.polls = {};
@ -204,7 +202,7 @@ RequestManager.prototype.poll = function () {
/*jshint maxcomplexity: 6 */
this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);
if (this.polls === {}) {
if (Object.keys(this.polls).length === 0) {
return;
}
@ -216,10 +214,8 @@ RequestManager.prototype.poll = function () {
var pollsData = [];
var pollsKeys = [];
for (var key in this.polls) {
if (this.polls.hasOwnProperty(key)) {
pollsData.push(this.polls[key].data);
pollsKeys.push(key);
}
pollsData.push(this.polls[key].data);
pollsKeys.push(key);
}
if (pollsData.length === 0) {
@ -242,13 +238,13 @@ RequestManager.prototype.poll = function () {
results.map(function (result, index) {
var key = pollsKeys[index];
// make sure the filter is still installed after arrival of the request
if(self.polls[key]) {
if (self.polls[key]) {
result.callback = self.polls[key].callback;
return result;
} else
return false;
}).filter(function (result) {
return (!result) ? false : true;
return !!result;
}).filter(function (result) {
var valid = Jsonrpc.getInstance().isValidResponse(result);
if (!valid) {