code: function wait(key, cb) {
      if (!waiting[key]) {
          waiting[key] = [];
      }
  
      waiting[key].push(cb);
  }
docs: register a handler for a resource
  the handler will be called when nobody before it is waiting
  for that resoruce