simplified synchronous polling

This commit is contained in:
Marek Kotewicz
2015-01-22 17:57:26 +01:00
parent 3073511e30
commit 81bbe8c93b
5 changed files with 34 additions and 50 deletions

View File

@@ -32,8 +32,7 @@ var Filter = function(options, impl) {
this.callbacks = [];
this.id = impl.newFilter(options);
web3.on(impl.changed, this.id, this.trigger.bind(this));
web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id);
web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id, this.trigger.bind(this));
};
/// alias for changed*
@@ -57,7 +56,6 @@ Filter.prototype.trigger = function(messages) {
Filter.prototype.uninstall = function() {
this.impl.uninstallFilter(this.id);
web3.provider.stopPolling(this.id);
web3.off(impl.changed, this.id);
};
/// should be called to manually trigger getting latest messages from the client