/*
Documented, #delay
177984
public static <T> java.util.concurrent.ScheduledFuture<T> delay(final Supplier<T> function,
        final int delayMilliseconds) {
        final java.util.concurrent.ScheduledExecutorService scheduler =
            java.util.concurrent.Executors.newSingleThreadScheduledExecutor();
        final java.util.concurrent.ScheduledFuture<T> future = scheduler.schedule(
            new java.util.concurrent.Callable<T>() {
                public T call() {
                    return function.get();
                }
            }, delayMilliseconds, java.util.concurrent.TimeUnit.MILLISECONDS);
        scheduler.shutdown();
        return future;
    }
847586
public CommunicationServiceBuilder delay(String socketName, Long delay) {
      return delay(socketName, delay, delay);
   }
305677
function later( delay ) {
    if ( typeof delay === 'undefined' ) delay = 1;
    return new Promise(
        function( resolve, reject ) {
            window.setTimeout( resolve, delay );
        }
    );
}
548731
def _delay(self, ms):
        
        if ms:
            self.Delay(ms)
        else:
            if self.default_delay:
                self.Delay(self.default_delay)
224100
function defer(fn) { var args
        args = slice.call(arguments, 1)
        return delay.apply(this, [fn, 0].concat(args))
    }
1289317
def delay!(uri)
      delay = delay(uri)
      sleep delay - (Time.now - @last_accessed) if delay
      @last_accessed = Time.now
    end
1115881
def p_delays(self, p):
        ''
        p[0] = DelayStatement(p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
77304
public static void delay(int ms, int nanos) {
    try {
      Thread.sleep(ms, nanos);
    } catch (InterruptedException e) {
      throw new RuntimeException("Interrupted", e);
    }
  }
293878
@Override
   public DelayedData getDelayed(String genericTag) {
      DelayedData d = delayedData.get(genericTag);
      return d == null ? dd : d;
   }
488140
function(func, wait) {
        var self = this,
            timeout,
            // args, // right now there is no need for arguments
            // context, // and for context
            timestamp
            // result // and for result

        var later = function() {
            if (self._disposed) {
                clearTimeout(timeout)
                timeout = self = null
                return
            }

            var last = getTime() - timestamp

            if (last < wait && last >= 0) {
                timeout = setTimeout(later, wait - last)
            } else {
                timeout = null
                // result = func.apply(context, args)
                func()
                // context = args = null
            }
        }

        return function() {
            // context = this
            // args = arguments
            timestamp = getTime()

            if (!timeout) {
                timeout = setTimeout(later, wait)
            }

            // return result
        }
    }
452981
int getDelay(int n) {
        int delay = -1;
        if ((n >= 0) && (n < header.frameCount)) {
            delay = header.frames.get(n).delay;
        }
        return delay;
    }
869062
function(delay) {
        var timer,
            promise = this.then(function(val) {
                var defer = new Deferred();
                timer = setTimeout(
                    function() {
                        defer.resolve(val);
                    },
                    delay);

                return defer.promise();
            });

        promise.always(function() {
            clearTimeout(timer);
        });

        return promise;
    }
648696
@Override
	public void onModify(WatchEvent<?> event, Path currentPath) {
		if(this.delay < 1) {
			this.watcher.onModify(event, currentPath);
		}else {
			onDelayModify(event, currentPath);
		}
	}
756925
function(key, delay, args) {
        this.clearTimer(key);

        var func;

        if (key === 'show') {
            func = this.position;
        } else {
            func = this.hide;
        }

        if (func) {
            this.timers[key] = setTimeout(function() {
                func.apply(this, args || []);
            }.bind(this), delay);
        }
    }
596723
function(delay) {
              $timeout.cancel(hider_.id_);

              // do not hide if -1 is passed in.
              if(delay !== "-1") {
                // delay the hiding operation for 1.5s by default.
                if (!isDef(delay)) {
                  delay = 1.5;
                }

                hider_.id_ = $timeout(function() {
                  $popover.off('click', insideClickHandler);
                  $document.off('click', outsideClickHandler);
                  elm.off('click', buttonClickHandler);
                  $popover.isOpen = false;
                  displayer_.cancel();
                  $popover.css('display', 'none');
                  removeEventListeners();

                  // Call the close callback
                  options.onClose(scope);
                }, delay*1000);
              }
            }
748556
function delayReject(delay = 1000) {
    const begin = time();

    const promise = new Promise((resolve, reject) => {
        setTimeout(() => {
            if (promise.payload) {
                reject(promise.payload);
            }
        }, delay);
    });

    return function proceed(error) {
        // if we haven't reached the delay yet, stash the payload
        // so the setTimeout above will resolve it later
        if (time() - begin < delay) {
            promise.payload = error;
            return promise;
        }

        throw error;
    };
}
35053
function wait(key, cb) {
    if (!waiting[key]) {
        waiting[key] = [];
    }

    waiting[key].push(cb);
}