docs: function wait(args, fn) {
      var resolved = false;
      args = argsToArray(arguments);
      fn = args.pop();
      var p = when(args);
      return function waiter() {
          if (!resolved) {
              var args = arguments;
              return p.chain(function () {
                  resolved = true;
                  p = null;
                  return fn.apply(this, args);
              }.bind(this));
          } else {
              return when(fn.apply(this, arguments));
          }
      };
  }