• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const timers = require('timers');
4
5// Delete global APIs to make sure they're not relied on by the internal timers
6// code
7delete global.setTimeout;
8delete global.clearTimeout;
9delete global.setInterval;
10delete global.clearInterval;
11delete global.setImmediate;
12delete global.clearImmediate;
13
14const timeoutCallback = () => { timers.clearTimeout(timeout); };
15const timeout = timers.setTimeout(common.mustCall(timeoutCallback), 1);
16
17const intervalCallback = () => { timers.clearInterval(interval); };
18const interval = timers.setInterval(common.mustCall(intervalCallback), 1);
19
20const immediateCallback = () => { timers.clearImmediate(immediate); };
21const immediate = timers.setImmediate(immediateCallback);
22