-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
28 lines (23 loc) · 1.14 KB
/
index.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
export {}
// @ts-ignore
Symbol.dispose ??= Symbol("Symbol.dispose")
declare global {
interface Uint8Array { [Symbol.dispose](): void }
interface Int8Array { [Symbol.dispose](): void }
interface Uint8ClampedArray { [Symbol.dispose](): void }
interface Uint16Array { [Symbol.dispose](): void }
interface Int16Array { [Symbol.dispose](): void }
interface Uint32Array { [Symbol.dispose](): void }
interface Int32Array { [Symbol.dispose](): void }
interface Buffer { [Symbol.dispose](): void }
}
Uint8Array.prototype[Symbol.dispose] = function () { this.fill(0) }
Int8Array.prototype[Symbol.dispose] = function () { this.fill(0) }
Uint8ClampedArray.prototype[Symbol.dispose] = function () { this.fill(0) }
Uint16Array.prototype[Symbol.dispose] = function () { this.fill(0) }
Int16Array.prototype[Symbol.dispose] = function () { this.fill(0) }
Uint32Array.prototype[Symbol.dispose] = function () { this.fill(0) }
Int32Array.prototype[Symbol.dispose] = function () { this.fill(0) }
if (typeof process !== 'undefined' && process.versions && process.versions.node) {
Buffer.prototype[Symbol.dispose] = function () { this.fill(0) }
}