Permalink
Browse files

[core, drinker] remove waitFor function

  • Loading branch information...
indutny committed Jun 18, 2011
1 parent 7cbd0f4 commit 2a72ef335527a41a5b1aab20677148307204cb78
Showing with 0 additions and 42 deletions.
  1. +0 −35 lib/bar/core.js
  2. +0 −7 lib/bar/drinker.js
View
@@ -23,11 +23,6 @@ function Bar(dir, options) {
this.drinkers = {};
this.drinkersByName = {};
- /**
- * Wait list for drinkers
- */
- this.waitList = {};
-
/**
* Store options
*/
@@ -102,12 +97,6 @@ Bar.prototype.enter = function(drinkers) {
that.drinkers[drinker.name] = that.drinkers[file] = drinker;
that.log(' > %s enters bar', drinker.name);
-
- /**
- * Notify waiters about new drinker
- */
- that.notifyWaiters(drinker.name);
- that.notifyWaiters(file);
});
});
});
@@ -130,30 +119,6 @@ Bar.prototype.leave = function(drinker) {
}
};
-/**
- * Wait for drinker to enter bar
- */
-Bar.prototype.waitFor = function(name, callback) {
- if (this.drinkers[name]) return process.nextTick(callback);
-
- /**
- * Add callback to waitList
- */
- var waitList = this.waitList[name] || (this.waitList[name] = []);
- waitList.push(callback);
-};
-
-/**
- * Notify waiters about new drinker
- */
-Bar.prototype.notifyWaiters = function(name) {
- if (!this.waitList[name]) return;
- this.waitList[name].forEach(function(fn) {
- fn();
- });
- this.waitList[name] = null;
-};
-
/**
* Log errors
*/
View
@@ -83,13 +83,6 @@ function Drinker(file, content, _bar) {
that.name = name;
},
- /**
- * Wait for drinker to enter bar
- */
- waitFor: function(name, callback) {
- _bar.waitFor(name, callback);
- },
-
/**
* Hook & snap
*/

0 comments on commit 2a72ef3

Please sign in to comment.