From 8b7f5531ee1ccde897e87890e9aabc554fedb9dd Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Mon, 9 Nov 2020 06:25:13 -0800 Subject: feat(std/node): consistent Node.js builtin shapes (#8274) --- std/node/_timers.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 std/node/_timers.ts (limited to 'std/node/_timers.ts') diff --git a/std/node/_timers.ts b/std/node/_timers.ts new file mode 100644 index 000000000..872e1f9ae --- /dev/null +++ b/std/node/_timers.ts @@ -0,0 +1,14 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. +// 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 = ( + // deno-lint-ignore no-explicit-any + cb: (...args: any[]) => void, + // deno-lint-ignore no-explicit-any + ...args: any[] +): number => window.setTimeout(cb, 0, ...args); +export const clearImmediate = window.clearTimeout; -- cgit v1.2.3