diff options
author | Guy Bedford <guybedford@gmail.com> | 2020-11-27 10:40:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-27 13:40:11 -0500 |
commit | ff3c5897ea7b8720894d2092c28889994f31c40e (patch) | |
tree | 8695a4858ce382cdd7f160303eae19892d04e811 /std/node/timers.ts | |
parent | d2b32a65a787c8d3185a8d3ad1212bc82e24a195 (diff) |
fix(std/node): Inline default objects to ensure correct prototype (#8513)
Diffstat (limited to 'std/node/timers.ts')
-rw-r--r-- | std/node/timers.ts | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/std/node/timers.ts b/std/node/timers.ts index 095f6c5dc..fd040ca5e 100644 --- a/std/node/timers.ts +++ b/std/node/timers.ts @@ -1,4 +1,23 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -export * from "./_timers.ts"; -import * as m from "./_timers.ts"; -export default m; +// 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; + +export default { + setTimeout, + clearTimeout, + setInterval, + clearInterval, + setImmediate, + clearImmediate, +}; |