deno.land / std@0.177.1 / node / global.ts

نووسراو ببینە
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.// deno-lint-ignore-file no-varimport processModule from "./process.ts";import { Buffer as bufferModule } from "./buffer.ts";import { clearInterval, clearTimeout, setInterval, setTimeout,} from "./timers.ts";import timers from "./timers.ts";
type GlobalType = { process: typeof processModule; Buffer: typeof bufferModule; setImmediate: typeof timers.setImmediate; clearImmediate: typeof timers.clearImmediate; setTimeout: typeof timers.setTimeout; clearTimeout: typeof timers.clearTimeout; setInterval: typeof timers.setInterval; clearInterval: typeof timers.clearInterval;};
declare global { interface Window { global: GlobalType; }
interface globalThis { global: GlobalType; }
var global: GlobalType; var process: typeof processModule; var Buffer: typeof bufferModule; type Buffer = bufferModule; var setImmediate: typeof timers.setImmediate; var clearImmediate: typeof timers.clearImmediate;}
Object.defineProperty(globalThis, "global", { value: new Proxy(globalThis, { get(target, prop, receiver) { switch (prop) { case "setInterval": return setInterval; case "setTimeout": return setTimeout; case "clearInterval": return clearInterval; case "clearTimeout": return clearTimeout; default: return Reflect.get(target, prop, receiver); } }, }), writable: false, enumerable: false, configurable: true,});
Object.defineProperty(globalThis, "process", { value: processModule, enumerable: false, writable: true, configurable: true,});
Object.defineProperty(globalThis, "Buffer", { value: bufferModule, enumerable: false, writable: true, configurable: true,});
Object.defineProperty(globalThis, "setImmediate", { value: timers.setImmediate, enumerable: true, writable: true, configurable: true,});
Object.defineProperty(globalThis, "clearImmediate", { value: timers.clearImmediate, enumerable: true, writable: true, configurable: true,});
export {};
std

Version Info

Tagged at
10 months ago