Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
return function wait(done) {
setTimeout(done, t);
};
}
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);
}
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);
}
function App() {
var state = hg.state({
updated: hg.value(false)
});
setTimeout(function timer() {
state.updated.set(true);
}, 2000);
return state;
}
promise: new Promise((resolve, _) => {
timer = timers.setTimeout(() => {
resolve(undefined);
}, ms);
}),
cancel() {
promise: new Promise((resolve, _) => {
timer = timers.setTimeout(() => {
resolve(undefined);
}, ms);
}),
cancel() {
Timer.prototype.start = function start(msecs) {
this.stop();
this._timeout = Timers.setTimeout(this._onTimeout.bind(this), msecs);
};
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(){