added debounce to 'latest' filter

This commit is contained in:
cubedro 2015-04-03 19:34:31 +03:00
parent c7e027d393
commit f87a378b4d
2 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@ var web3 = require('ethereum.js');
var _ = require('lodash'); var _ = require('lodash');
var os = require('os'); var os = require('os');
var shelljs = require('shelljs'); var shelljs = require('shelljs');
var debounce = require('debounce');
var Primus = require('primus'), var Primus = require('primus'),
Emitter = require('primus-emit'), Emitter = require('primus-emit'),
@ -386,7 +387,9 @@ Node.prototype.setWatches = function()
this.chainFilter = web3.eth.filter('latest'); this.chainFilter = web3.eth.filter('latest');
this.chainFilter.watch(function(log) { this.chainFilter.watch(function(log) {
self.update(); debounce(function() {
self.update();
}, 50);
}); });
this.updateInterval = setInterval(function(){ this.updateInterval = setInterval(function(){

View File

@ -8,6 +8,7 @@
"lib": "./lib" "lib": "./lib"
}, },
"dependencies": { "dependencies": {
"debounce": "^1.0.0",
"debug": "~2.1.3", "debug": "~2.1.3",
"ethereum.js": "0.2.4", "ethereum.js": "0.2.4",
"lodash": "^3.6.0", "lodash": "^3.6.0",