@moddable/typings 7.1.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,82 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "web/websocket" {
22
+ import Headers from "headers"
23
+
24
+ interface WebSocketOptions {
25
+ url: string;
26
+ protocol?: string;
27
+ keepalive?: number;
28
+ headers?: Headers | Record<string, string>;
29
+ attach?: any;
30
+ ws?: any;
31
+ wss?: any;
32
+ }
33
+
34
+ interface WebSocketCloseEvent {
35
+ code: number;
36
+ reason: string;
37
+ wasClean: boolean;
38
+ }
39
+
40
+ interface WebSocketMessageEvent {
41
+ data: string | ArrayBuffer;
42
+ }
43
+
44
+ interface WebSocketEvent {
45
+ // Generic event object
46
+ }
47
+
48
+ interface WebSocketErrorEvent {
49
+ message?: string;
50
+ }
51
+
52
+ type WebSocketEventListener = (event: any) => void;
53
+
54
+ class WebSocket {
55
+ constructor(url: string, protocol?: string);
56
+ constructor(options: WebSocketOptions);
57
+
58
+ binaryType: "arraybuffer";
59
+ readonly bufferedAmount: number;
60
+ readonly extensions: string;
61
+ readonly protocol: string;
62
+ readonly readyState: number;
63
+ readonly url: string;
64
+
65
+ onclose?(event: WebSocketCloseEvent): void;
66
+ onerror?(event: WebSocketErrorEvent): void;
67
+ onmessage?(event: WebSocketMessageEvent): void;
68
+ onopen?(event: WebSocketEvent): void;
69
+
70
+ addEventListener(event: "close", listener: (event: WebSocketCloseEvent) => void): void;
71
+ addEventListener(event: "error", listener: (event: WebSocketErrorEvent) => void): void;
72
+ addEventListener(event: "message", listener: (event: WebSocketMessageEvent) => void): void;
73
+ addEventListener(event: "open", listener: (event: WebSocketEvent) => void): void;
74
+
75
+ removeEventListener(event: "close" | "error" | "message" | "open", listener: WebSocketEventListener): void;
76
+
77
+ close(code?: number, reason?: string): void;
78
+ send(data: string | ArrayBuffer | ArrayBufferView): void;
79
+ }
80
+
81
+ export default WebSocket;
82
+ }
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "webstorage" {
22
+ class WebStorage {
23
+ constructor(kvp: any);
24
+ get length(): number;
25
+ key(index: number): string | null;
26
+ getItem(key: string): string | null;
27
+ setItem(key: string, value: string): void;
28
+ remove(key: string): void;
29
+ clear(): void;
30
+ }
31
+
32
+ export default WebStorage;
33
+ }
File without changes
File without changes