prompt.on('close', () => clearTimeout(timeout));
const delay = function (ms) { let timeout, prev; return function (msg, prompt) { return new Promise((resolve, reject) => { clearTimeout(timeout); if (prev) { msg = prev; prev = null; resolve(msg); return; } timeout = setTimeout(() => { prev = msg; prompt.render(); }, ms); resolve(''); }); } }
}; clearTimeout(this.numberTimeout); clearTimeout(this.numberTimeout); if (val) res = number(num); this.num = '';
prompt.once('close', () => clearTimeout(prompt.state.timeout));
clearInterval(this.interval); this.interval = null; clearTimeout(this.timeout); this.timeout = null;
clearCbTimeout(id: number) { if (!this.timeout[id]) { logger.warn('timer is not exsits, serverId: %s remote: %s, host: %s, port: %s', this.serverId, id, this.host, this.port); return; } clearTimeout(this.timeout[id]); delete this.timeout[id]; }
setupKeepAlive() { clearTimeout(this.reconnectId); clearTimeout(this.timeoutId); let self = this; this.keepaliveTimer = setInterval(function () { self.checkKeepAlive(); }, this.keepalive); }
/** * Clear last timeout and schedule the next job, it will automaticly run the job that * need to run now * @param job The job need to schedule * @return void */ function setTimer(job: Job.Job) { clearTimeout(timer); timer = setTimeout(excuteJob, job.excuteTime() - Date.now()); }
disconnect() { if (this.socket) { if (this.socket.disconnect) this.socket.disconnect(); if (this.socket.close) this.socket.close(); this.logger.log('disconnect'); this.socket = null; } if (this.heartbeatId) { clearTimeout(this.heartbeatId); this.heartbeatId = null; } if (this.heartbeatTimeoutId) { clearTimeout(this.heartbeatTimeoutId); this.heartbeatTimeoutId = null; } }
after(err: Error, routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, resp: any, next: HandlerCallback) { let timeout = this.timeouts[(session as any).__timeout__]; if (timeout) { clearTimeout(timeout); this.timeOutCount--; this.timeouts[(session as any).__timeout__] = undefined; } next(err); }
this.socket.connect({ clientId: 'MQTT_RPC_' + Date.now() }, function () { if (self.connected) { return; } clearTimeout(connectTimeout); self.connected = true; if (self.bufferMsg) { self._interval = setInterval(function () { self.flush(self); }, self.interval); } self.setupKeepAlive(); });
clearTimers(id: number) { delete this.clients[id]; let tid = this.timeouts[id]; if (tid) { clearTimeout(tid); delete this.timeouts[id]; } }
/** *wrap clearTimeout * * @param {Number} timerId * */ clean(timerId: NodeJS.Timer) { clearTimeout(timerId); }
clear(id: number) { let tid = this.timeouts[id]; if (tid) { clearTimeout(tid); delete this.timeouts[id]; } }
clearCbTimeout(id: number) { if (!this.timeout[id]) { logger.warn('timer is not exsits, serverId: %s remote: %s, host: %s, port: %s', this.serverId, id, this.host, this.port); return; } clearTimeout(this.timeout[id]); delete this.timeout[id]; }