event options
This commit is contained in:
@ -27,16 +27,19 @@ var web3 = require('./web3'); // jshint ignore:line
|
||||
|
||||
/// should be used when we want to watch something
|
||||
/// it's using inner polling mechanism and is notified about changes
|
||||
var Filter = function(options, impl) {
|
||||
this.impl = impl;
|
||||
this.callbacks = [];
|
||||
/// TODO: change 'options' name cause it may be not the best matching one, since we have events
|
||||
var Filter = function(options, indexed, impl) {
|
||||
|
||||
if (typeof options !== "string") {
|
||||
// evaluate lazy properties
|
||||
if (options._isEvent) {
|
||||
return options(indexed);
|
||||
} else if (typeof options !== "string") {
|
||||
|
||||
// topics property is deprecated, warn about it!
|
||||
if (options.topics) {
|
||||
console.warn('"topics" is deprecated, use "topic" instead');
|
||||
}
|
||||
|
||||
// evaluate lazy properties
|
||||
options = {
|
||||
to: options.to,
|
||||
topic: options.topic,
|
||||
@ -46,7 +49,11 @@ var Filter = function(options, impl) {
|
||||
skip: options.skip,
|
||||
address: options.address
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
this.impl = impl;
|
||||
this.callbacks = [];
|
||||
|
||||
this.id = impl.newFilter(options);
|
||||
web3.provider.startPolling({call: impl.changed, args: [this.id]}, this.id, this.trigger.bind(this));
|
||||
|
Reference in New Issue
Block a user