How to use the timers.setTimeout 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 Raynos / mercury / examples / async-state.js View on Github external
function App() {
    var state = hg.state({
        isUpdated: hg.value(false)
    });
    // Arrange for state to be updated asynchronously
    setTimeout(function updateState() {
        state.isUpdated.set(true);
    }, 2000);
    return state;
}
github uber-archive / hyperbahn / test / register / register-with-slow-affinity.js View on Github external
function sendNext() {
        if (--counter === 0) {
            return setTimeout(invokeCb, 500);
        }

        cluster.sendRegister(dummy, {
            serviceName: 'hello-bob',
            host: exitNodes[0].hostPort,
            timeout: 500
        }, onError);

        setTimeout(sendNext, 50);
    }
github uber-archive / hyperbahn / test / health.js View on Github external
function onResponse(err, resp) {
        assert.ifError(err);

        assert.equal(resp.body, 'hello from autobahn\n');

        setTimeout(function flush() {
            app.clients.batchStats.flushStats();
            setTimeout(finish, 500);
        }, 500);
    }
github Raynos / mercury / examples / real-dom.js View on Github external
function App() {
    var state = hg.state({
        updated: hg.value(false)
    });
    setTimeout(function timer() {
        state.updated.set(true);
    }, 2000);
    return state;
}
github wpilibsuite / vscode-wpilib / vscode-wpilib-core / src / riolog / rioconnector.ts View on Github external
promise: new Promise((resolve, _) => {
      timer = timers.setTimeout(() => {
        resolve(undefined);
      }, ms);
    }),
    cancel() {
github wpilibsuite / vscode-wpilib / libraries / wpilib-riolog / src / rioconnector.ts View on Github external
promise: new Promise((resolve, _) => {
      timer = timers.setTimeout(() => {
        resolve(undefined);
      }, ms);
    }),
    cancel() {
github pablomarle / networkmaps / node_modules / mysql / lib / protocol / Timer.js View on Github external
Timer.prototype.start = function start(msecs) {
  this.stop();
  this._timeout = Timers.setTimeout(this._onTimeout.bind(this), msecs);
};
github rundeck / rundeck / rundeckapp / grails-spa / src / components / activity / activityList.vue View on Github external
checkrefresh(time: number = 0) {
      if(!this.loadingRunning && this.autorefresh){
        let delay: number = time ? (new Date().getTime() - time) : 0
        let ms = this.loadError ? (this.autorefreshms * 10) : this.autorefreshms
        ms = time > 0 ? Math.min(60000, Math.max(ms, 5 * delay)) : 0
        this.autorefreshtimeout = setTimeout(() => {
          let cur = new Date()
          Promise.all([
            this.loadRunning(),
            this.loadSince()
          ]).then(() => this.checkrefresh(cur.getTime()))
        }, ms);
      }
    },
    startAutorefresh(){

timers

A tiny cron-like tools for humman.

MIT
Latest version published 10 years ago

Package Health Score

47 / 100
Full package analysis