Repository navigation
Expand file tree
/
Copy pathtimers.ts
More file actions
40 lines (36 loc) · 1.6 KB
/
Copy pathtimers.ts
File metadata and controls
40 lines (36 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// `node:timers` -- the module surface over the timer globals.
//
// The implementations are in `runtime/node/global-timers.ts`, which is a
// SCRIPT: its declarations land in the real global scope, because that is
// where library code reads them from (`setTimeout(forceClose, ms)` with no
// import in sight). See that file's header for why a script, and for the
// ambient declaration this replaced.
//
// Node exposes the same functions twice -- as globals AND as `node:timers`
// exports -- so this file is the second half of that, not a second
// implementation. Each name below is a local ALIAS of the one global:
// `const x = globalX` keeps the value identity and `type X = GlobalX` keeps
// the type identity, and a single `export { x as name }` specifier carries
// both meanings. The alias is what a module can do at all: `export
// { setTimeout }` on a name this file does not declare is "Cannot export
// 'setTimeout'. Only local declarations can be exported from a module."
const TimeoutAlias = Timeout
type TimeoutAlias = Timeout
const ImmediateAlias = Immediate
type ImmediateAlias = Immediate
const setTimeoutAlias = setTimeout
const setIntervalAlias = setInterval
const clearTimeoutAlias = clearTimeout
const clearIntervalAlias = clearInterval
const setImmediateAlias = setImmediate
const clearImmediateAlias = clearImmediate
export {
TimeoutAlias as Timeout,
ImmediateAlias as Immediate,
setTimeoutAlias as setTimeout,
setIntervalAlias as setInterval,
clearTimeoutAlias as clearTimeout,
clearIntervalAlias as clearInterval,
setImmediateAlias as setImmediate,
clearImmediateAlias as clearImmediate
}