diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2020-01-15 20:13:12 +0100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2020-01-15 14:13:12 -0500 |
commit | 3eab20ce42458fced42dcd031958b07113322e0a (patch) | |
tree | 5444f37030cf5b7158432025ae71b49d06469531 /std/node/timers.ts | |
parent | b310f32e39785987ddd3491e189aad06381d0139 (diff) |
feat(std/node): Added node timers builtin (#3634)
Diffstat (limited to 'std/node/timers.ts')
-rw-r--r-- | std/node/timers.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/std/node/timers.ts b/std/node/timers.ts new file mode 100644 index 000000000..b942d5fbc --- /dev/null +++ b/std/node/timers.ts @@ -0,0 +1,11 @@ +// TODO: implement the 'NodeJS.Timeout' and 'NodeJS.Immediate' versions of the timers. +// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1163ead296d84e7a3c80d71e7c81ecbd1a130e9a/types/node/v12/globals.d.ts#L1120-L1131 +export const setTimeout = window.setTimeout; +export const clearTimeout = window.clearTimeout; +export const setInterval = window.setInterval; +export const clearInterval = window.clearInterval; +export const setImmediate = ( + cb: (...args: unknown[]) => void, + ...args: unknown[] +): number => window.setTimeout(cb, 0, ...args); +export const clearImmediate = window.clearTimeout; |