mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 23:24:37 +00:00

This commit repurposes `--unstable-node-globals` flag that was deprecated in https://github.com/denoland/deno/pull/29887 to switch out timers implemention that is used. Ie. using this flag cause `setTimeout`, `setInterval`, `clearTimeout` and `clearInterval` globals to use functions from `node:timers` module instead of the Web version. This is also enabled using `DENO_COMPAT=1` env var. TODO: <s>make typechecking be conditional depending on this, most likely requires changes in our TS fork.</s> This has been deferred until Deno 3 Towards https://github.com/denoland/deno/issues/29703 --------- Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
6 lines
141 B
TypeScript
6 lines
141 B
TypeScript
const i = setImmediate(() => {});
|
|
console.log(i);
|
|
clearImmediate(i);
|
|
const t = setTimeout(() => {}, 1_000);
|
|
console.log(t);
|
|
clearTimeout(t);
|