Wait

@param {...} args
199224
function () {
  let args = sliced(arguments)
  let done = args[args.length - 1]
  if (args.length < 2) {
    // not enought params
    return done()
  }

  let selector = args[0]
  if (typeof selector === 'string') {
    let callback = args[1]
    let timeout = null

    if (typeof callback === 'string') {
      let shouldBe = null

      if (typeof args[2] !== 'function') {
        shouldBe = args[2]
      }

      if (typeof args[3] === 'number') {
        timeout = args[3]
      }

      callback = (element) => _get(element, args[1]) === shouldBe
    } else if (typeof args[1] === 'number') {
      timeout = args[1]
    }

    if (args.length < 3) {
      callback = null
    }

    waitelem.apply({ timeout, callback }, [this, selector, done])
  } else {
    done()
  }
}
901878
def wait(state)
      if !LXC::Shell.valid_state?(status.state)
        raise ArgumentError, "Invalid container state: #{state}"
      end

      run("wait", "-s", state)
    end
1057170
function whenReady() {
    var pendingObjects = [].slice.call(arguments),
        wait = pendingObjects.length,
        resolvedCallback,
        promise = {
            run : function (callback) {
                resolvedCallback = callback;
            }
        },
        resolved = function () {
            wait -= 1;
            if (wait <= 0 && resolvedCallback) {
                resolvedCallback();
            }
        },
        i;

    for (i = 0; i < pendingObjects.length; i++) {
        if (typeof pendingObjects[i].onReady === 'function') {
            pendingObjects[i].onReady(resolved);
        } else {
            window.setTimeout(resolved, 0);
        }
    }
    if (pendingObjects.length === 0) {
        window.setTimeout(resolved, 0);
    }

    return promise; // to Domenic, this is not a promise, I know :).
}
1267123
function wait_loading(callback) {
		var undefined,
		    events = 0,
		    foreach_loading = true,
		    errors = [];
		
		function do_end() {
			callback( (errors.length === 0) ? undefined : 'Errors:\n * ' + errors.join(' * \n') );
		}
		
		foreach(_dirs_loading).do(function(e, id) {
			events++;
			e.on('end', function(err) {
				if(err) errors.push(err);
				events--;
				if( (!foreach_loading) && (events === 0) ) do_end();
			});
		});
		
		foreach_loading = false;
		if(events === 0) do_end();
	}
226311
def wait(self, **kwargs):
        """"""
        if self.request:
            self.request.wait(**kwargs)
            self.request = None
        return self.inflate()
1308789
function addWait(manager) {
            if (!waiting[manager.id]) {
                waiting[manager.id] = manager;
                waitAry.push(manager);
                context.waitCount += 1;
            }
        }
498125
def wait(self, allowed_methods=None):
        """"""
        method_sig, args, content = self.connection._wait_method(
            self.channel_id, allowed_methods)

        return self.dispatch_method(method_sig, args, content)
547134
def wait(self, timeout=None):
        
        import threading

        if self._state!=self.PENDING:
            return

        e = threading.Event()
        self.addCallback(lambda v: e.set())
        self.addErrback(lambda r: e.set())
        e.wait(timeout)
985397
def wait(predicate, interval=1, message=lambda: "Waiting..."):
    """"""
    ball, next_ball = u"|/-\\", "|"
    sys.stdout.write("    \033[K")
    sys.stdout.flush()
    while not predicate():
        time.sleep(1)
        next_ball = ball[(ball.index(next_ball) + 1) % len(ball)]
        sys.stdout.write("\r " + str(message()) + " " + next_ball + " \033[K")
        sys.stdout.flush()
    print("\r Done. \033[K")
    sys.stdout.flush()
533496
public static function wait(string $args) : ?SymfonyProcess
  {
    $process = new SymfonyProcess('php ' . Accessor::$appRoot . 'craftsman ' . $args);

    $process->start();
    $process->wait();
    $process->stop();

    return $process;
  }
47345
function wait() {
        var isDone = false;
        var start = new Date().getTime();

        var interval = setInterval(() => {
            var now = new Date().getTime();
            if ((now - start) >= _retryInterval){
                clearInterval(interval);
                isDone = true;
            }
        }, 50);

        deasync.loopWhile(() => !isDone);
    }
684116
function async (f, args) {
    new Promise(invoke).then(function asyncFulfill () {
      return f.apply(null, args);
    });
  }
726822
function waitfn () {
  const softTimeout = this.timeout || null
  const callback = this.callback
  let executionTimer
  let softTimeoutTimer
  let self = arguments[0]

  let args = sliced(arguments)
  let done = args[args.length - 1]

  let timeoutTimer = setTimeout(function () {
    clearTimeout(executionTimer)
    clearTimeout(softTimeoutTimer)
    done(new Error(`.wait() timed out after ${self.options.waitTimeout}msec`))
  }, self.options.waitTimeout)
  return tick.apply(this, arguments)

  function tick (self, fn) {
    if (softTimeout) {
      softTimeoutTimer = setTimeout(function () {
        clearTimeout(executionTimer)
        clearTimeout(timeoutTimer)
        done()
      }, softTimeout)
    }

    let waitDone = function (err, result) {
      if (callback) {
        result = callback(result)
      }
      if (result) {
        clearTimeout(timeoutTimer)
        clearTimeout(softTimeoutTimer)
        return done()
      } else if (err) {
        clearTimeout(timeoutTimer)
        clearTimeout(softTimeoutTimer)
        return done(err)
      } else {
        executionTimer = setTimeout(function () {
          tick.apply(self, args)
        }, self.options.pollInterval)
      }
    }
    let newArgs = [fn, waitDone].concat(args.slice(2, -1))
    self.evaluate_now.apply(self, newArgs)
  }
}
598424
function (arg) {
						if ( ! arg.allow ){
							return;
						}

						var exist = false;
						for (var i in data.allow) {
							if (data.allow[i] === arg.allow) {
								exist = true;
							}
						}
						if ( exist === false ) {
							data.allow[data.allow.length] = arg.allow;
						}
					}
394539
function (args) {
            var reqId = args.reqId;
            var callback = args.cb;

            delete this._pending[reqId];

            var response = {
                error : this.LOAD_PLUGIN,
                status : 0
            };

            callback.fn.call(callback.scope, true, callback.args, response);
        }
1325736
function fireWaits(module) {
		map(waits[module.id], function(fn) { fn(module); });
		waits[module.id] = [];
	}
158794
function waitUntil(fun) {
    var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var interval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 20;

    var timedOut = false;
    var ok = false;

    if (timeout !== 0) (0, _wait2['default'])(timeout).then(function () {
        return timedOut = true;
    });

    return new Promise(function (resolve, reject) {
        var runLoop = function runLoop() {
            if (ok) {
                resolve();
                return;
            }
            if (timedOut) {
                reject(new Error('AsyncTestUtil.waitUntil(): reached timeout of ' + timeout + 'ms'));
                return;
            }
            (0, _wait2['default'])(interval).then(function () {
                var value = (0, _promisify2['default'])(fun());
                value.then(function (val) {
                    ok = val;
                    runLoop();
                });
            });
        };
        runLoop();
    });
}