parsing events output

This commit is contained in:
Marek Kotewicz
2015-02-03 16:16:38 +01:00
parent 1860b3dff9
commit a5909d82eb
6 changed files with 71 additions and 15 deletions

View File

@ -36,6 +36,8 @@ var Filter = function(options, impl) {
if (options.topics) {
console.warn('"topics" is deprecated, use "topic" instead');
}
this._onWatchResult = options._onWatchEventResult;
// evaluate lazy properties
options = {
@ -71,7 +73,8 @@ Filter.prototype.changed = function(callback) {
Filter.prototype.trigger = function(messages) {
for (var i = 0; i < this.callbacks.length; i++) {
for (var j = 0; j < messages.length; j++) {
this.callbacks[i].call(this, messages[j]);
var message = this._onWatchResult ? this._onWatchResult(messages[j]) : messages[j];
this.callbacks[i].call(this, message);
}
}
};