How to use the timers.setImmediate function in timers

To help you get started, we’ve selected a few timers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github killmag10 / nodeschnaps / lib / nodeschnaps / async.js View on Github external
var watcher = function watcher()
    {
        if(result.finish.valueOf()) {
            timers.setImmediate(callback, result.error, result.result);
        } else {
            timers.setImmediate(watcher);
        }
    };
github saul / demofile / dist / demo.js View on Github external
_recurse() {
        const now = Date.now();
        if (now - this._lastThreadYieldTime < 32) {
            this._immediateTimerToken = timers.setImmediate(this._parseRecurse.bind(this));
        }
        else {
            this._lastThreadYieldTime = now;
            this._timeoutTimerToken = timers.setTimeout(this._parseRecurse.bind(this), 0);
        }
    }
    _parseRecurse() {
github saul / demofile / demo.js View on Github external
_recurse() {
    let now = Date.now();

    if (now - this._lastThreadYieldTime < 32) {
      this._immediateTimerToken = timers.setImmediate(this._parseRecurse.bind(this));
    } else {
      this._lastThreadYieldTime = now;
      this._timeoutTimerToken = timers.setTimeout(this._parseRecurse.bind(this), 0);
    }
  }
github saul / demofile / src / demo.ts View on Github external
private _recurse() {
    const now = Date.now();

    if (now - this._lastThreadYieldTime < 32) {
      this._immediateTimerToken = timers.setImmediate(
        this._parseRecurse.bind(this)
      );
    } else {
      this._lastThreadYieldTime = now;
      this._timeoutTimerToken = timers.setTimeout(
        this._parseRecurse.bind(this),
        0
      );
    }
  }

timers

A tiny cron-like tools for humman.

MIT
Latest version published 10 years ago

Package Health Score

47 / 100
Full package analysis