Timeout Module
@param {Component} Component
964979
function TimeoutModule(Component){

  Component.implement({
    /**
     * just like setTimeout, but will enter digest automately
     * @param  {Function} fn    
     * @param  {Number}   delay 
     * @return {Number}   timeoutid
     */
    $timeout: function(fn, delay){
      delay = delay || 0;
      return setTimeout(function(){
        fn.call(this);
        this.$update(); //enter digest
      }.bind(this), delay);
    },
    /**
     * just like setInterval, but will enter digest automately
     * @param  {Function} fn    
     * @param  {Number}   interval 
     * @return {Number}   intervalid
     */
    $interval: function(fn, interval){
      interval = interval || 1000/60;
      return setInterval(function(){
        fn.call(this);
        this.$update(); //enter digest
      }.bind(this), interval);
    }
  });
}
523992
function setTimeoutZero(fn) {
		/*
		Workaround for postMessage bug in Firefox if the page is loaded from the file system
		https://bugzilla.mozilla.org/show_bug.cgi?id=740576
		Should run fine, but maybe a few milliseconds slower per frame.
		*/
		function timeoutFunction() {
			if (timeouts.length) {
				(timeouts.shift())();
			}
		}

		if (typeof fn !== 'function') {
			throw 'setTimeoutZero argument is not a function';
		}

		timeouts.push(fn);
		if (window.location.protocol === 'file:') {
			setTimeout(timeoutFunction, 0);
			return;
		}

		window.postMessage('seriously-timeout-message', window.location);
	}
1163917
def timeout(self, timeout):
        '''
        '''
        if self._timeout is None:
            self.event('connection_made').bind(self._add_timeout)
            self.event('connection_lost').bind(self._cancel_timeout)
        self._timeout = timeout or 0
        self._add_timeout(None)
60667
function setPrefixTimeout(element) {
  resetPrefixTimeout(element);
  element[prefixTimeoutKey] = setTimeout(() => {
    resetTypedPrefix(element);
  }, TYPING_TIMEOUT_DURATION);
}
931573
function Timer(timeout, timeoutCallback) {
  this.finalTime = false;
  this.time = Date.now();
  this.TimerFunction = setTimeout(timeoutCallback, timeout);
}
356052
function cancel() {
    timeouts.forEach(function (timeout) {
      clearTimeout(timeout);
    });
    Object.keys(callbacks).forEach(function (key) {
      callbacks[key]('cancel');
      delete callbacks[key];
    });
    timeouts = [];
  }
540792
def timeout(self, value):
        """"""
        self.check_pyb()
        try:
            self.pyb.serial.timeout = value
        except:
            # timeout is a property so it calls code, and that can fail
            # if the serial port is closed.
            pass
925465
function timeout(req, delay) {
  setTimeout(_timeout, delay);

  function _timeout() {
    let callback = callbacks[req.id];

    if (!callback) return;

    let err = new Error("request timeout");

    err.name = "Timeout";

    callback(rpc.error(req, err).error);

    delete callbacks[req.id];
  }
}
403574
def timeout(self, value):
        """"""

        if value == TIMEOUT_SESSION:
            self._config.timeout = None
            self._backend_client.expires = None
        else:
            self._config.timeout = value
            self._calculate_expires()
407422
function() {
      // Timeouts are routed through the parent window, because on
      // some browsers designMode windows do not fire timeouts.
      var self = this;
      this.parent.clearTimeout(this.highlightTimeout);
      this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay);
    }
197583
def timeout(seconds=10, default_output='default_output'):
    
    def decorator(func):
        def _handle_timeout(signum, frame):
            """ throw the custom TimeoutError if called """
            raise TimeoutError(strerror(ETIME))

        def wrapper(*args, **kwargs):
            """ main wrapper for the error """
            # set up the propper error signal
            signal(SIGALRM, _handle_timeout)
            # set the time the function has to run
            alarm(seconds)
            try:
                result = func(*args, **kwargs)
            except TimeoutError:
                if default_output == 'default_output':
                    raise
                else:
                    result = default_output
            finally:
                # cancel the timer
                alarm(0)
            return result

        return wraps(func)(wrapper)
    return decorator
1211687
function() {
			if (!gui.hosted) {
				clearTimeout(this._timeout);
				this._timeout = setTimeout(function() {
					gui.broadcastGlobal(gui.BROADCAST_RESIZE_END);
				}, gui.TIMEOUT_RESIZE_END);
			}
		}
68358
function setTimeoutContext(fn, ctx, timeout) {
  var id;

  var cancel = function() {
    clearTimeout(id);
  };

  id = setTimeout(function() {
    ctx.removeListener('cancel', cancel);

    fn();
  }, timeout);

  ctx.once('cancel', cancel);
}
947805
public void setTimeout(Duration timeout) {

        LettuceAssert.notNull(timeout, "Timeout duration must not be null");
        LettuceAssert.isTrue(!timeout.isNegative(), "Timeout duration must be greater or equal to zero");

        this.timeout = timeout;

        if (channelWriter instanceof CommandExpiryWriter) {
            ((CommandExpiryWriter) channelWriter).setTimeout(timeout);
        }
    }
1038192
static void initSelectTimeout() {
        String currentTimeout = System.getProperty(PROPERTY_NETTY_SELECT_TIMEOUT);
        if (currentTimeout == null || "".equals(currentTimeout)) {
            try {
                System.setProperty(PROPERTY_NETTY_SELECT_TIMEOUT, Long.toString(DEFAULT_SELECT_TIMEOUT_MILLIS));
            }
            catch (SecurityException e) {
                if (logger.isWarnEnabled()) {
                    logger.warn(String.format(
                            "Unable to set System property \"%s\" to %d due to %s, Gateway performance may be reduced",
                            PROPERTY_NETTY_SELECT_TIMEOUT, DEFAULT_SELECT_TIMEOUT_MILLIS, e));
                }
            }
        }
    }
330959
def _timeout_handler(self, signum, frame):
        
        msgfmt = 'plugin timed out after {0} seconds'
        self.exit(code=self._timeout_code,
                  message=msgfmt.format(self._timeout_delay))
602952
public void setDefaultTimeout(Duration timeout) {

        LettuceAssert.notNull(timeout, "Timeout duration must not be null");
        LettuceAssert.isTrue(!timeout.isNegative(), "Timeout duration must be greater or equal to zero");

        this.timeout = timeout;
    }