@moddable/typings 8.3.1 → 9.0.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.
- package/embedded/storage/key-value.d.ts +2 -2
- package/embedded_io/socket/tcp/tls.d.ts +46 -9
- package/embedded_io/socket/tcp.d.ts +6 -8
- package/embedded_network/interface/wifi/accesspoint.d.ts +65 -0
- package/embedded_network/interface/wifi.d.ts +1 -0
- package/mcpack.d.ts +71 -14
- package/package.json +7 -6
- package/pebble/location.d.ts +2 -2
- package/web/abortsignal.d.ts +37 -0
- package/web/console.d.ts +50 -0
- package/web/decompressionstream.d.ts +34 -0
- package/web/domexception.d.ts +29 -0
- package/web/eventsource.d.ts +1 -1
- package/web/streams.d.ts +216 -0
- package/web/textdecoderstream.d.ts +37 -0
- package/web/textencoderstream.d.ts +29 -0
- package/web/timers.d.ts +33 -0
- package/web/websocket.d.ts +7 -3
- package/web/websocketstream.d.ts +53 -0
|
@@ -33,8 +33,8 @@ declare module "embedded:storage/key-value" {
|
|
|
33
33
|
|
|
34
34
|
delete(key: string): void;
|
|
35
35
|
|
|
36
|
-
read(key: string): ArrayBuffer | string | number | bigint;
|
|
37
|
-
read(key: string, buffer: ByteBuffer): number;
|
|
36
|
+
read(key: string): ArrayBuffer | string | number | bigint | undefined;
|
|
37
|
+
read(key: string, buffer: ByteBuffer): number | undefined;
|
|
38
38
|
write(key: string, value: ByteBuffer | string | number | bigint): void;
|
|
39
39
|
|
|
40
40
|
[Symbol.iterator](): IterableIterator<string>;
|
|
@@ -1,17 +1,54 @@
|
|
|
1
1
|
declare module "embedded:io/socket/tcp/tls" {
|
|
2
|
-
import { Options as TCPOptions } from "embedded:io/socket/tcp"
|
|
3
|
-
|
|
2
|
+
import TCP, { Options as TCPOptions } from "embedded:io/socket/tcp"
|
|
3
|
+
|
|
4
|
+
export type TLSVersion = "TLSv1.1" | "TLSv1.2" | "TLSv1.3"
|
|
5
|
+
|
|
6
|
+
export type TLSOptions = {
|
|
7
|
+
/** Server Name Indication (SNI) and the name certificates are validated against. */
|
|
4
8
|
host: string
|
|
5
|
-
|
|
9
|
+
minimumVersion?: TLSVersion
|
|
10
|
+
maximumVersion?: TLSVersion
|
|
11
|
+
/** Application-Layer Protocol Negotiation (ALPN). */
|
|
12
|
+
applicationLayerProtocol?: string | ByteBuffer | Array<string | ByteBuffer>
|
|
13
|
+
maximumFragmentLength?: number
|
|
14
|
+
ca?: ByteBuffer | ByteBuffer[]
|
|
15
|
+
clientKey?: ByteBuffer | ByteBuffer[]
|
|
16
|
+
clientCertificate?: ByteBuffer | ByteBuffer[]
|
|
17
|
+
|
|
18
|
+
// Moddable SDK extensions
|
|
19
|
+
/** Trace TLS protocol activity. Defaults to `false`. */
|
|
20
|
+
trace?: boolean
|
|
21
|
+
/** Verify the server's certificate chain. Defaults to `true`. Never disable in production. */
|
|
22
|
+
verify?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Extends the TCP socket's options object. Listed explicitly so the callbacks
|
|
26
|
+
can be typed with `this` as the TLS socket rather than the TCP socket. */
|
|
27
|
+
export type Options = {
|
|
28
|
+
address: string
|
|
29
|
+
port: number
|
|
30
|
+
noDelay?: boolean
|
|
31
|
+
format?: "number" | "buffer"
|
|
32
|
+
target?: any
|
|
33
|
+
onReadable?: (this: TLSSocket, bytes: number) => void
|
|
34
|
+
onWritable?: (this: TLSSocket, bytes: number) => void
|
|
35
|
+
onError?: (this: TLSSocket) => void
|
|
36
|
+
|
|
37
|
+
tls: TLSOptions
|
|
38
|
+
/** The TCP socket this TLS socket runs over. A Moddable SDK extension. */
|
|
39
|
+
TCP: { io: new (options: TCPOptions) => TCP } & Partial<TCPOptions>
|
|
6
40
|
}
|
|
7
|
-
|
|
41
|
+
|
|
42
|
+
class TLSSocket {
|
|
8
43
|
constructor(options: Options)
|
|
9
44
|
close(): void
|
|
10
|
-
read(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
45
|
+
read(): number | ArrayBuffer
|
|
46
|
+
read(byteLength: number): ArrayBuffer
|
|
47
|
+
read(buffer: ByteBuffer): number
|
|
48
|
+
write(buffer: ByteBuffer, options?: { more?: boolean, byteLength?: number }): number
|
|
49
|
+
get format(): "number" | "buffer"
|
|
50
|
+
set format(value: "number" | "buffer")
|
|
14
51
|
}
|
|
15
52
|
interface TLSSocket extends Disposable {}
|
|
53
|
+
export default TLSSocket;
|
|
16
54
|
}
|
|
17
|
-
|
|
@@ -19,16 +19,13 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
declare module "embedded:io/socket/tcp" {
|
|
22
|
-
export type Options = ((
|
|
22
|
+
export type Options = (({
|
|
23
23
|
address: string;
|
|
24
|
-
} | {
|
|
25
|
-
host: string;
|
|
26
|
-
}) & {
|
|
27
24
|
port: number;
|
|
28
25
|
}) | {
|
|
29
26
|
from: TCP;
|
|
30
27
|
}) & {
|
|
31
|
-
|
|
28
|
+
noDelay?: boolean;
|
|
32
29
|
onReadable?: (this: TCP, bytes: number) => void;
|
|
33
30
|
onWritable?: (this: TCP, bytes: number) => void;
|
|
34
31
|
onError?: (this: TCP) => void;
|
|
@@ -40,9 +37,10 @@ declare module "embedded:io/socket/tcp" {
|
|
|
40
37
|
constructor(options: Options)
|
|
41
38
|
readonly remoteAddress: string | undefined;
|
|
42
39
|
readonly remotePort: number | undefined;
|
|
43
|
-
read(
|
|
44
|
-
read(
|
|
45
|
-
|
|
40
|
+
read(): number | ArrayBuffer;
|
|
41
|
+
read(byteLength: number): ArrayBuffer;
|
|
42
|
+
read(buffer: ByteBuffer): number;
|
|
43
|
+
write(value: number | ByteBuffer): number;
|
|
46
44
|
close(): void;
|
|
47
45
|
get format(): "number" | "buffer"
|
|
48
46
|
set format(value: "number" | "buffer")
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser 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 Runtime 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 Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare module "embedded:network/interface/wifi/accesspoint" {
|
|
22
|
+
export type WiFiAccessPointChangedProperty = "connection";
|
|
23
|
+
|
|
24
|
+
export type WiFiAccessPointAuthentication = "none" | "wpa_psk" | "wpa2_psk" | "wpa_wpa2_psk" | "wpa3_psk" | "wpa2_wpa3_psk";
|
|
25
|
+
|
|
26
|
+
export interface WiFiAccessPointStation extends Disposable {
|
|
27
|
+
close(): void;
|
|
28
|
+
|
|
29
|
+
readonly MAC: string;
|
|
30
|
+
readonly address: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface WiFiAccessPointConstructorOptions {
|
|
34
|
+
SSID: string;
|
|
35
|
+
password?: string;
|
|
36
|
+
authentication?: WiFiAccessPointAuthentication;
|
|
37
|
+
channel?: number;
|
|
38
|
+
hidden?: boolean;
|
|
39
|
+
max?: number;
|
|
40
|
+
interval?: number;
|
|
41
|
+
onChanged?(this: WiFiAccessPoint, property: WiFiAccessPointChangedProperty): void;
|
|
42
|
+
onConnect?(this: WiFiAccessPoint, station: WiFiAccessPointStation): void;
|
|
43
|
+
onDisconnect?(this: WiFiAccessPoint, station: WiFiAccessPointStation): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface WiFiAccessPointConfigureOptions {
|
|
47
|
+
portal?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
class WiFiAccessPoint {
|
|
51
|
+
constructor(options: WiFiAccessPointConstructorOptions);
|
|
52
|
+
|
|
53
|
+
close(): void;
|
|
54
|
+
configure(options: WiFiAccessPointConfigureOptions): void;
|
|
55
|
+
|
|
56
|
+
readonly connection: number;
|
|
57
|
+
readonly address: string | undefined;
|
|
58
|
+
readonly MAC: string | undefined;
|
|
59
|
+
readonly SSID: string | undefined;
|
|
60
|
+
readonly channel: number | undefined;
|
|
61
|
+
}
|
|
62
|
+
interface WiFiAccessPoint extends Disposable {}
|
|
63
|
+
|
|
64
|
+
export default WiFiAccessPoint;
|
|
65
|
+
}
|
package/mcpack.d.ts
CHANGED
|
@@ -18,32 +18,29 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/// <reference path="./web/abortsignal.d.ts" />
|
|
22
|
+
/// <reference path="./web/console.d.ts" />
|
|
23
|
+
/// <reference path="./web/decompressionstream.d.ts" />
|
|
24
|
+
/// <reference path="./web/domexception.d.ts" />
|
|
21
25
|
/// <reference path="./web/eventsource.d.ts" />
|
|
22
26
|
/// <reference path="./web/fetch.d.ts" />
|
|
23
27
|
/// <reference path="./web/headers.d.ts" />
|
|
28
|
+
/// <reference path="./web/streams.d.ts" />
|
|
24
29
|
/// <reference path="./web/structuredClone.d.ts" />
|
|
30
|
+
/// <reference path="./web/textdecoderstream.d.ts" />
|
|
31
|
+
/// <reference path="./web/textencoderstream.d.ts" />
|
|
32
|
+
/// <reference path="./web/timers.d.ts" />
|
|
25
33
|
/// <reference path="./web/url.d.ts" />
|
|
26
|
-
/// <reference path="./web/worker.d.ts" />
|
|
27
34
|
/// <reference path="./web/websocket.d.ts" />
|
|
35
|
+
/// <reference path="./web/websocketstream.d.ts" />
|
|
28
36
|
/// <reference path="./web/webstorage.d.ts" />
|
|
37
|
+
/// <reference path="./web/worker.d.ts" />
|
|
29
38
|
/// <reference path="./text/decoder.d.ts" />
|
|
30
39
|
/// <reference path="./text/encoder.d.ts" />
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
interface Console {
|
|
35
|
-
log(...log: (string | number | boolean)[]):void;
|
|
36
|
-
}
|
|
41
|
+
export {};
|
|
37
42
|
|
|
38
43
|
declare global {
|
|
39
|
-
const console: Console;
|
|
40
|
-
const clearImmediate: (timer: Timer) => void;
|
|
41
|
-
const clearInterval: (timer: Timer) => void;
|
|
42
|
-
const clearTimeout: (timer: Timer) => void;
|
|
43
|
-
const setImmediate: (handler: Function) => Timer;
|
|
44
|
-
const setInterval: (handler: Function, timeout?: number) => Timer;
|
|
45
|
-
const setTimeout: (handler: Function, timeout?: number) => Timer;
|
|
46
|
-
|
|
47
44
|
const EventSource: typeof import("web/eventsource").default;
|
|
48
45
|
type EventSource = import("web/eventsource").default;
|
|
49
46
|
|
|
@@ -76,5 +73,65 @@ declare global {
|
|
|
76
73
|
|
|
77
74
|
const SharedWorker: typeof import("worker").SharedWorker;
|
|
78
75
|
type SharedWorker = import("worker").SharedWorker;
|
|
76
|
+
|
|
77
|
+
const AbortController: typeof import("web/abortsignal").AbortController;
|
|
78
|
+
type AbortController = import("web/abortsignal").AbortController;
|
|
79
|
+
|
|
80
|
+
const AbortSignal: typeof import("web/abortsignal").AbortSignal;
|
|
81
|
+
type AbortSignal = import("web/abortsignal").AbortSignal;
|
|
82
|
+
|
|
83
|
+
const DOMException: typeof import("web/domexception").DOMException;
|
|
84
|
+
type DOMException = import("web/domexception").DOMException;
|
|
85
|
+
|
|
86
|
+
const ReadableStream: typeof import("web/streams").ReadableStream;
|
|
87
|
+
type ReadableStream<R = any> = import("web/streams").ReadableStream<R>;
|
|
88
|
+
|
|
89
|
+
const ReadableStreamDefaultReader: typeof import("web/streams").ReadableStreamDefaultReader;
|
|
90
|
+
type ReadableStreamDefaultReader<R = any> = import("web/streams").ReadableStreamDefaultReader<R>;
|
|
91
|
+
|
|
92
|
+
const ReadableStreamBYOBReader: typeof import("web/streams").ReadableStreamBYOBReader;
|
|
93
|
+
type ReadableStreamBYOBReader = import("web/streams").ReadableStreamBYOBReader;
|
|
94
|
+
|
|
95
|
+
const ReadableStreamDefaultController: typeof import("web/streams").ReadableStreamDefaultController;
|
|
96
|
+
type ReadableStreamDefaultController<R = any> = import("web/streams").ReadableStreamDefaultController<R>;
|
|
97
|
+
|
|
98
|
+
const ReadableByteStreamController: typeof import("web/streams").ReadableByteStreamController;
|
|
99
|
+
type ReadableByteStreamController = import("web/streams").ReadableByteStreamController;
|
|
100
|
+
|
|
101
|
+
const ReadableStreamBYOBRequest: typeof import("web/streams").ReadableStreamBYOBRequest;
|
|
102
|
+
type ReadableStreamBYOBRequest = import("web/streams").ReadableStreamBYOBRequest;
|
|
103
|
+
|
|
104
|
+
const WritableStream: typeof import("web/streams").WritableStream;
|
|
105
|
+
type WritableStream<W = any> = import("web/streams").WritableStream<W>;
|
|
106
|
+
|
|
107
|
+
const WritableStreamDefaultWriter: typeof import("web/streams").WritableStreamDefaultWriter;
|
|
108
|
+
type WritableStreamDefaultWriter<W = any> = import("web/streams").WritableStreamDefaultWriter<W>;
|
|
109
|
+
|
|
110
|
+
const WritableStreamDefaultController: typeof import("web/streams").WritableStreamDefaultController;
|
|
111
|
+
type WritableStreamDefaultController = import("web/streams").WritableStreamDefaultController;
|
|
112
|
+
|
|
113
|
+
const TransformStream: typeof import("web/streams").TransformStream;
|
|
114
|
+
type TransformStream<I = any, O = any> = import("web/streams").TransformStream<I, O>;
|
|
115
|
+
|
|
116
|
+
const TransformStreamDefaultController: typeof import("web/streams").TransformStreamDefaultController;
|
|
117
|
+
type TransformStreamDefaultController<O = any> = import("web/streams").TransformStreamDefaultController<O>;
|
|
118
|
+
|
|
119
|
+
const ByteLengthQueuingStrategy: typeof import("web/streams").ByteLengthQueuingStrategy;
|
|
120
|
+
type ByteLengthQueuingStrategy = import("web/streams").ByteLengthQueuingStrategy;
|
|
121
|
+
|
|
122
|
+
const CountQueuingStrategy: typeof import("web/streams").CountQueuingStrategy;
|
|
123
|
+
type CountQueuingStrategy = import("web/streams").CountQueuingStrategy;
|
|
124
|
+
|
|
125
|
+
const DecompressionStream: typeof import("web/decompressionstream").default;
|
|
126
|
+
type DecompressionStream = import("web/decompressionstream").default;
|
|
127
|
+
|
|
128
|
+
const TextDecoderStream: typeof import("web/textdecoderstream").default;
|
|
129
|
+
type TextDecoderStream = import("web/textdecoderstream").default;
|
|
130
|
+
|
|
131
|
+
const TextEncoderStream: typeof import("web/textencoderstream").default;
|
|
132
|
+
type TextEncoderStream = import("web/textencoderstream").default;
|
|
133
|
+
|
|
134
|
+
const WebSocketStream: typeof import("web/websocketstream").default;
|
|
135
|
+
type WebSocketStream = import("web/websocketstream").default;
|
|
79
136
|
}
|
|
80
137
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moddable/typings",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"main": "",
|
|
5
|
-
"types":
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
"types": "xs",
|
|
6
|
+
"typesVersions": {
|
|
7
|
+
">=6.0.0-0": { "tsconfig.base.json": ["./tsconfig.es2025.json"] },
|
|
8
|
+
">=5.4.0-0": { "tsconfig.base.json": ["./tsconfig.es2024.json"] }
|
|
9
|
+
},
|
|
10
|
+
"author": "Moddable",
|
|
10
11
|
"license": "ISC",
|
|
11
12
|
"description": ""
|
|
12
13
|
}
|
package/pebble/location.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ interface LocationSample {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
interface LocationOptions {
|
|
33
|
-
onSample?: () => void;
|
|
34
|
-
onError?: (error: Error) => void;
|
|
33
|
+
onSample?: (this: Location) => void;
|
|
34
|
+
onError?: (this: Location, error: Error) => void;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
interface LocationConfiguration {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/abortsignal" {
|
|
22
|
+
class AbortSignal {
|
|
23
|
+
readonly aborted: boolean;
|
|
24
|
+
readonly reason: any;
|
|
25
|
+
throwIfAborted(): void;
|
|
26
|
+
static abort(reason?: any): AbortSignal;
|
|
27
|
+
static timeout(milliseconds: number): AbortSignal;
|
|
28
|
+
static any(signals: AbortSignal[]): AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
class AbortController {
|
|
32
|
+
readonly signal: AbortSignal;
|
|
33
|
+
abort(reason?: any): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { AbortSignal, AbortController };
|
|
37
|
+
}
|
package/web/console.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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
|
+
export {};
|
|
22
|
+
|
|
23
|
+
declare module "web/console" {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
interface Console {
|
|
28
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
29
|
+
clear(): void;
|
|
30
|
+
count(label?: string): void;
|
|
31
|
+
countReset(label?: string): void;
|
|
32
|
+
debug(...data: any[]): void;
|
|
33
|
+
dir(item?: any): void;
|
|
34
|
+
dirxml(...data: any[]): void;
|
|
35
|
+
error(...data: any[]): void;
|
|
36
|
+
group(...data: any[]): void;
|
|
37
|
+
groupCollapsed(...data: any[]): void;
|
|
38
|
+
groupEnd(): void;
|
|
39
|
+
info(...data: any[]): void;
|
|
40
|
+
log(...data: any[]): void;
|
|
41
|
+
table(tabularData?: any): void;
|
|
42
|
+
time(label?: string): void;
|
|
43
|
+
timeEnd(label?: string): void;
|
|
44
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
45
|
+
trace(...data: any[]): void;
|
|
46
|
+
warn(...data: any[]): void;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const console: Console;
|
|
50
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/decompressionstream" {
|
|
22
|
+
import type { ReadableStream, WritableStream } from "web/streams";
|
|
23
|
+
|
|
24
|
+
type DecompressionFormat = "deflate" | "deflate-raw" | "gzip";
|
|
25
|
+
|
|
26
|
+
class DecompressionStream {
|
|
27
|
+
constructor(format: DecompressionFormat);
|
|
28
|
+
readonly readable: ReadableStream<Uint8Array>;
|
|
29
|
+
readonly writable: WritableStream<Uint8Array>;
|
|
30
|
+
readonly format: DecompressionFormat;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default DecompressionStream;
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/domexception" {
|
|
22
|
+
class DOMException extends Error {
|
|
23
|
+
constructor(message?: string, name?: string);
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { DOMException };
|
|
29
|
+
}
|
package/web/eventsource.d.ts
CHANGED
package/web/streams.d.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/streams" {
|
|
22
|
+
import type { AbortSignal } from "web/abortsignal";
|
|
23
|
+
|
|
24
|
+
interface QueuingStrategyInit {
|
|
25
|
+
highWaterMark: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface QueuingStrategy<T = any> {
|
|
29
|
+
highWaterMark?: number;
|
|
30
|
+
size?(chunk: T): number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface UnderlyingSource<R = any> {
|
|
34
|
+
start?(controller: ReadableStreamDefaultController<R>): void | Promise<void>;
|
|
35
|
+
pull?(controller: ReadableStreamDefaultController<R>): void | Promise<void>;
|
|
36
|
+
cancel?(reason?: any): void | Promise<void>;
|
|
37
|
+
type?: undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface UnderlyingByteSource {
|
|
41
|
+
start?(controller: ReadableByteStreamController): void | Promise<void>;
|
|
42
|
+
pull?(controller: ReadableByteStreamController): void | Promise<void>;
|
|
43
|
+
cancel?(reason?: any): void | Promise<void>;
|
|
44
|
+
type: "bytes";
|
|
45
|
+
autoAllocateChunkSize?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface UnderlyingSink<W = any> {
|
|
49
|
+
start?(controller: WritableStreamDefaultController): void | Promise<void>;
|
|
50
|
+
write?(chunk: W, controller: WritableStreamDefaultController): void | Promise<void>;
|
|
51
|
+
close?(): void | Promise<void>;
|
|
52
|
+
abort?(reason?: any): void | Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface Transformer<I = any, O = any> {
|
|
56
|
+
readableType?: undefined;
|
|
57
|
+
writableType?: undefined;
|
|
58
|
+
start?(controller: TransformStreamDefaultController<O>): void | Promise<void>;
|
|
59
|
+
transform?(chunk: I, controller: TransformStreamDefaultController<O>): void | Promise<void>;
|
|
60
|
+
flush?(controller: TransformStreamDefaultController<O>): void | Promise<void>;
|
|
61
|
+
cancel?(reason?: any): void | Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface StreamPipeOptions {
|
|
65
|
+
preventClose?: boolean;
|
|
66
|
+
preventAbort?: boolean;
|
|
67
|
+
preventCancel?: boolean;
|
|
68
|
+
signal?: AbortSignal;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface ReadableWritablePair<R = any, W = any> {
|
|
72
|
+
readable: ReadableStream<R>;
|
|
73
|
+
writable: WritableStream<W>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type ReadableStreamReadValueResult<T> = { done: false; value: T };
|
|
77
|
+
type ReadableStreamReadDoneResult<T> = { done: true; value: T | undefined };
|
|
78
|
+
type ReadableStreamReadResult<T> =
|
|
79
|
+
| ReadableStreamReadValueResult<T>
|
|
80
|
+
| ReadableStreamReadDoneResult<T>;
|
|
81
|
+
|
|
82
|
+
class ReadableStream<R = any> {
|
|
83
|
+
constructor(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>);
|
|
84
|
+
constructor(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>);
|
|
85
|
+
readonly locked: boolean;
|
|
86
|
+
cancel(reason?: any): Promise<void>;
|
|
87
|
+
getReader(): ReadableStreamDefaultReader<R>;
|
|
88
|
+
getReader(options: { mode?: undefined }): ReadableStreamDefaultReader<R>;
|
|
89
|
+
getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
|
|
90
|
+
pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
|
|
91
|
+
pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
|
|
92
|
+
tee(): [ReadableStream<R>, ReadableStream<R>];
|
|
93
|
+
values(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
|
|
94
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<R>;
|
|
95
|
+
static from<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
class ReadableStreamDefaultReader<R = any> {
|
|
99
|
+
constructor(stream: ReadableStream<R>);
|
|
100
|
+
readonly closed: Promise<undefined>;
|
|
101
|
+
cancel(reason?: any): Promise<void>;
|
|
102
|
+
read(): Promise<ReadableStreamReadResult<R>>;
|
|
103
|
+
releaseLock(): void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
class ReadableStreamBYOBReader {
|
|
107
|
+
constructor(stream: ReadableStream<Uint8Array>);
|
|
108
|
+
readonly closed: Promise<undefined>;
|
|
109
|
+
cancel(reason?: any): Promise<void>;
|
|
110
|
+
read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
|
|
111
|
+
releaseLock(): void;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
class ReadableStreamDefaultController<R = any> {
|
|
115
|
+
readonly desiredSize: number | null;
|
|
116
|
+
close(): void;
|
|
117
|
+
enqueue(chunk?: R): void;
|
|
118
|
+
error(e?: any): void;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
class ReadableByteStreamController {
|
|
122
|
+
readonly byobRequest: ReadableStreamBYOBRequest | null;
|
|
123
|
+
readonly desiredSize: number | null;
|
|
124
|
+
close(): void;
|
|
125
|
+
enqueue(chunk: ArrayBufferView): void;
|
|
126
|
+
error(e?: any): void;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
class ReadableStreamBYOBRequest {
|
|
130
|
+
readonly view: ArrayBufferView | null;
|
|
131
|
+
respond(bytesWritten: number): void;
|
|
132
|
+
respondWithNewView(view: ArrayBufferView): void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
class WritableStream<W = any> {
|
|
136
|
+
constructor(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>);
|
|
137
|
+
readonly locked: boolean;
|
|
138
|
+
abort(reason?: any): Promise<void>;
|
|
139
|
+
close(): Promise<void>;
|
|
140
|
+
getWriter(): WritableStreamDefaultWriter<W>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
class WritableStreamDefaultWriter<W = any> {
|
|
144
|
+
constructor(stream: WritableStream<W>);
|
|
145
|
+
readonly closed: Promise<undefined>;
|
|
146
|
+
readonly desiredSize: number | null;
|
|
147
|
+
readonly ready: Promise<undefined>;
|
|
148
|
+
abort(reason?: any): Promise<void>;
|
|
149
|
+
close(): Promise<void>;
|
|
150
|
+
releaseLock(): void;
|
|
151
|
+
write(chunk?: W): Promise<void>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
class WritableStreamDefaultController {
|
|
155
|
+
readonly signal: AbortSignal;
|
|
156
|
+
error(e?: any): void;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
class TransformStream<I = any, O = any> {
|
|
160
|
+
constructor(
|
|
161
|
+
transformer?: Transformer<I, O>,
|
|
162
|
+
writableStrategy?: QueuingStrategy<I>,
|
|
163
|
+
readableStrategy?: QueuingStrategy<O>
|
|
164
|
+
);
|
|
165
|
+
readonly readable: ReadableStream<O>;
|
|
166
|
+
readonly writable: WritableStream<I>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
class TransformStreamDefaultController<O = any> {
|
|
170
|
+
readonly desiredSize: number | null;
|
|
171
|
+
enqueue(chunk?: O): void;
|
|
172
|
+
error(reason?: any): void;
|
|
173
|
+
terminate(): void;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
class ByteLengthQueuingStrategy {
|
|
177
|
+
constructor(init: QueuingStrategyInit);
|
|
178
|
+
readonly highWaterMark: number;
|
|
179
|
+
size(chunk: ArrayBufferView): number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
class CountQueuingStrategy {
|
|
183
|
+
constructor(init: QueuingStrategyInit);
|
|
184
|
+
readonly highWaterMark: number;
|
|
185
|
+
size(): number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
ReadableStream,
|
|
190
|
+
ReadableStreamDefaultReader,
|
|
191
|
+
ReadableStreamBYOBReader,
|
|
192
|
+
ReadableStreamDefaultController,
|
|
193
|
+
ReadableByteStreamController,
|
|
194
|
+
ReadableStreamBYOBRequest,
|
|
195
|
+
WritableStream,
|
|
196
|
+
WritableStreamDefaultWriter,
|
|
197
|
+
WritableStreamDefaultController,
|
|
198
|
+
TransformStream,
|
|
199
|
+
TransformStreamDefaultController,
|
|
200
|
+
ByteLengthQueuingStrategy,
|
|
201
|
+
CountQueuingStrategy,
|
|
202
|
+
};
|
|
203
|
+
export type {
|
|
204
|
+
QueuingStrategyInit,
|
|
205
|
+
QueuingStrategy,
|
|
206
|
+
UnderlyingSource,
|
|
207
|
+
UnderlyingByteSource,
|
|
208
|
+
UnderlyingSink,
|
|
209
|
+
Transformer,
|
|
210
|
+
StreamPipeOptions,
|
|
211
|
+
ReadableWritablePair,
|
|
212
|
+
ReadableStreamReadResult,
|
|
213
|
+
ReadableStreamReadValueResult,
|
|
214
|
+
ReadableStreamReadDoneResult,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/textdecoderstream" {
|
|
22
|
+
import type { TransformStream } from "web/streams";
|
|
23
|
+
|
|
24
|
+
interface TextDecoderStreamInit {
|
|
25
|
+
fatal?: boolean;
|
|
26
|
+
ignoreBOM?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {
|
|
30
|
+
constructor(label?: string, options?: TextDecoderStreamInit);
|
|
31
|
+
readonly encoding: string;
|
|
32
|
+
readonly fatal: boolean;
|
|
33
|
+
readonly ignoreBOM: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default TextDecoderStream;
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/textencoderstream" {
|
|
22
|
+
import type { TransformStream } from "web/streams";
|
|
23
|
+
|
|
24
|
+
class TextEncoderStream extends TransformStream<string, Uint8Array> {
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default TextEncoderStream;
|
|
29
|
+
}
|
package/web/timers.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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
|
+
import type Timer from "timer";
|
|
22
|
+
|
|
23
|
+
declare module "web/timers" {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
const clearImmediate: (timer: Timer | undefined | null) => void;
|
|
28
|
+
const clearInterval: (timer: Timer | undefined | null) => void;
|
|
29
|
+
const clearTimeout: (timer: Timer | undefined | null) => void;
|
|
30
|
+
const setImmediate: (handler: Function) => Timer;
|
|
31
|
+
const setInterval: (handler: Function, timeout?: number) => Timer;
|
|
32
|
+
const setTimeout: (handler: Function, timeout?: number) => Timer;
|
|
33
|
+
}
|
package/web/websocket.d.ts
CHANGED
|
@@ -21,16 +21,19 @@
|
|
|
21
21
|
declare module "web/websocket" {
|
|
22
22
|
import Headers from "headers"
|
|
23
23
|
|
|
24
|
-
interface
|
|
24
|
+
interface WebSocketClientOptions {
|
|
25
25
|
url: string;
|
|
26
26
|
protocol?: string;
|
|
27
27
|
keepalive?: number;
|
|
28
28
|
headers?: Headers | Record<string, string>;
|
|
29
|
-
attach?: any;
|
|
30
29
|
ws?: any;
|
|
31
30
|
wss?: any;
|
|
32
31
|
}
|
|
33
32
|
|
|
33
|
+
interface WebSocketAttachOptions {
|
|
34
|
+
attach: any;
|
|
35
|
+
}
|
|
36
|
+
|
|
34
37
|
interface WebSocketCloseEvent {
|
|
35
38
|
code: number;
|
|
36
39
|
reason: string;
|
|
@@ -53,7 +56,8 @@ declare module "web/websocket" {
|
|
|
53
56
|
|
|
54
57
|
class WebSocket {
|
|
55
58
|
constructor(url: string, protocol?: string);
|
|
56
|
-
constructor(options:
|
|
59
|
+
constructor(options: WebSocketClientOptions);
|
|
60
|
+
constructor(options: WebSocketAttachOptions);
|
|
57
61
|
|
|
58
62
|
static readonly CONNECTING: 0;
|
|
59
63
|
static readonly OPEN: 1;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 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/websocketstream" {
|
|
22
|
+
import type { AbortSignal } from "web/abortsignal";
|
|
23
|
+
import type { ReadableStream, WritableStream } from "web/streams";
|
|
24
|
+
|
|
25
|
+
interface WebSocketStreamOptions {
|
|
26
|
+
protocols?: string | string[];
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
ws?: any;
|
|
29
|
+
wss?: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface WebSocketCloseInfo {
|
|
33
|
+
closeCode?: number;
|
|
34
|
+
reason?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface WebSocketConnection {
|
|
38
|
+
readable: ReadableStream<string | Uint8Array>;
|
|
39
|
+
writable: WritableStream<string | ArrayBuffer | ArrayBufferView>;
|
|
40
|
+
extensions: string;
|
|
41
|
+
protocol: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class WebSocketStream {
|
|
45
|
+
constructor(url: string, options?: WebSocketStreamOptions);
|
|
46
|
+
readonly url: string;
|
|
47
|
+
readonly opened: Promise<WebSocketConnection>;
|
|
48
|
+
readonly closed: Promise<Required<WebSocketCloseInfo>>;
|
|
49
|
+
close(closeInfo?: WebSocketCloseInfo): void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default WebSocketStream;
|
|
53
|
+
}
|