forked from TurboWarp/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobals.d.ts
More file actions
103 lines (94 loc) · 2.22 KB
/
globals.d.ts
File metadata and controls
103 lines (94 loc) · 2.22 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
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
93
94
95
96
97
98
99
100
101
102
103
/**
* @fileoverview
* Defines extra APIs that exist in real web browsers but that are missing from TypeScript's default types.
*/
interface Element {
/**
* requestFullscreen() but available in Safari.
*/
webkitRequestFullscreen?(): unknown;
}
interface Document {
/**
* exitFullscreen() but available in Safari.
*/
webkitExitFullscreen?(): unknown;
/**
* fullscreenElement but available in Safari.
*/
webkitFullscreenElement?: Element;
}
/**
* https://developer.mozilla.org/en-US/docs/Web/API/NDEFReader
*/
declare class NDEFReader extends EventTarget {
constructor();
scan(options?: { signal?: AbortSignal }): Promise<void>;
onreading?(event: Event & { message: NDEFMessage }): void;
onreadingerror?(event: Event): void;
}
type TypedArray =
| Uint8Array
| Int8Array
| Uint16Array
| Int16Array
| Uint32Array
| Int32Array
| BigUint64Array
| BigInt64Array;
/**
* https://developer.mozilla.org/en-US/docs/Web/API/NDEFMessage/NDEFMessage
*/
declare class NDEFMessage {
constructor(
records: Array<{
data?: string | ArrayBuffer | TypedArray | DataView | NDEFRecord[];
encoding?: string;
id?: string;
lang?: string;
mediaType?: string;
recordType?: string;
}>
);
readonly records: NDEFRecord[];
}
/**
* https://developer.mozilla.org/en-US/docs/Web/API/NDEFRecord
*/
declare class NDEFRecord {
constructor();
readonly recordType: string;
readonly mediaType: string;
readonly id: string;
readonly data: DataView;
readonly encoding: string | null;
readonly lang: string | null;
toRecords(): NDEFRecord[];
}
interface NetworkInformation {
downlink: number;
downlinkMax: number;
effectiveType: string;
rtt: number;
saveData: boolean;
type:
| "bluetooth"
| "cellular"
| "ethernet"
| "none"
| "wifi"
| "wimax"
| "other"
| "unknown";
}
interface Navigator {
connection?: NetworkInformation;
}
declare namespace Scratch.extensions {
/**
* Most extensions fail the type checking of @turbowarp/types-tw's default register().
* That error generally isn't very useful - so for now we'll just add this overload so
* that those errors don't appear.
*/
function register(extensionObj: any): void;
}