function waitFor(emitter, event, timeout, fn) {
var called = false, handler, timer;
handler = function() {
called = true;
clearTimeout(timer);
fn.apply(this, arguments);
}
var timer = setTimeout(function() {
emitter.removeListener(handler);
if (! called) return fn("TIMEOUT");
}, timeout);
emitter.once(event, handler);
}
L.
> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>
--
Laurie Harper
http://laurie.holoweb.net/