node-zookeeper-client
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -20,3 +20,4 @@ /** | ||
function registerWatcher(self, type, path, watcher) { | ||
var watchers = self[type + 'Watchers']; | ||
var watchers = self[type + 'Watchers'], | ||
watcherExists = false; | ||
@@ -30,4 +31,9 @@ Path.validate(path); | ||
watchers[path] = watchers[path] || new events.EventEmitter(); | ||
watcherExists = watchers[path].listeners('notification').some(function (l) { | ||
// This is rather hacky since node.js wraps the listeners using an | ||
// internal function. | ||
return l === watcher || l.listener === watcher; | ||
}); | ||
if (watchers[path].listeners('notification').indexOf(watcher) === -1) { | ||
if (!watcherExists) { | ||
watchers[path].once('notification', watcher); | ||
@@ -34,0 +40,0 @@ } |
{ | ||
"name": "node-zookeeper-client", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A pure Javascript ZooKeeper client for Node.js.", | ||
@@ -5,0 +5,0 @@ "author": "Alex Guan <alex.guan@gmail.com>", |
145609
37
3690