summaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-refresh-in-callback.js
blob: df62512acd60b1a18446686e90592cbefa923181 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'use strict';

const common = require('../common');

// This test checks whether a refresh called inside the callback will keep
// the event loop alive to run the timer again.

let didCall = false;
const timer = setTimeout(common.mustCall(() => {
  if (!didCall) {
    didCall = true;
    timer.refresh();
  }
}, 2), 1);