@moddable/typings 8.3.0 → 9.0.0
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/sensor/Barometer-Humidity-Temperature/BME280.d.ts +102 -0
- package/embedded/sensor/Location/fixed.d.ts +39 -0
- package/embedded/sensor/Location/ip.d.ts +44 -0
- package/embedded/sensor/Location/location.d.ts +56 -0
- package/embedded/sensor/RFID/mfrc522-spi.d.ts +64 -0
- package/embedded/sensor/RFID/mfrc522.d.ts +50 -0
- 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.d.ts +1 -0
- package/mcpack.d.ts +71 -14
- package/package.json +7 -6
- package/piu/ImageBuffer.d.ts +43 -0
- package/piu/MC-types.d.ts +4 -4
- 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
- package/xs.d.ts +0 -103
|
@@ -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
|
+
}
|
package/xs.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2020-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
|
-
interface Trace {
|
|
22
|
-
(...log: (string | number | boolean)[]):void;
|
|
23
|
-
left(log: string | ArrayBufferLike, conversation?: string):void;
|
|
24
|
-
center(log: string | ArrayBufferLike, conversation?: string):void;
|
|
25
|
-
right(log: string | ArrayBufferLike, conversation?: string):void;
|
|
26
|
-
}
|
|
27
|
-
declare const trace:Trace;
|
|
28
|
-
|
|
29
|
-
declare class HostBuffer {
|
|
30
|
-
readonly byteLength: number
|
|
31
|
-
private brand: boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
interface ArrayBufferTypes {
|
|
35
|
-
HostBuffer: HostBuffer;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface ByteBufferTypes extends ArrayBufferTypes {
|
|
39
|
-
Uint8Array: Uint8Array,
|
|
40
|
-
Uint8ClampedArray: Uint8ClampedArray,
|
|
41
|
-
Int8Array: Int8Array,
|
|
42
|
-
DataView: DataView
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type ByteBuffer = ByteBufferTypes[keyof ByteBufferTypes];
|
|
46
|
-
|
|
47
|
-
interface ObjectConstructor {
|
|
48
|
-
freeze<T>(obj: T, freeze?: boolean | number): Readonly<T>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface JSON {
|
|
52
|
-
parse(text: string, reviver?: string[]): any;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface StringConstructor {
|
|
56
|
-
fromArrayBuffer(buffer: ArrayBufferLike): string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
interface ArrayBufferConstructor {
|
|
60
|
-
fromString(string: string): ArrayBuffer;
|
|
61
|
-
fromBigInt(value: bigint): ArrayBuffer;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
interface ArrayBuffer {
|
|
65
|
-
concat(...buffers: ArrayBufferLike[]): ArrayBuffer;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface Uint8Array {
|
|
69
|
-
toHex(): string;
|
|
70
|
-
toBase64(): string
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface FromBase64Options {
|
|
74
|
-
alphabet?: "base64url" | "base64";
|
|
75
|
-
lastChunkHandling?: "stop-before-partial" | "strict" | "loose";
|
|
76
|
-
omitPadding?: boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
interface Uint8ArrayConstructor {
|
|
80
|
-
fromBase64(base64: string, options?: FromBase64Options): Uint8Array;
|
|
81
|
-
fromHex(string: string): Uint8Array;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface BigIntConstructor {
|
|
85
|
-
bitLength(value: bigint): number
|
|
86
|
-
fromArrayBuffer(buffer: ArrayBufferLike): bigint
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// integer math proposal
|
|
90
|
-
interface Math {
|
|
91
|
-
idiv(a: number, b: number): number
|
|
92
|
-
imod(a: number, b: number): number
|
|
93
|
-
imuldiv(a: number, b: number, c: number): number
|
|
94
|
-
irandom(a: number, b: number): number
|
|
95
|
-
irem(a: number, b: number): number
|
|
96
|
-
mod(a: number, b: number): number
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// xs host objects, host functions
|
|
100
|
-
declare function Native(name: string): new (...args: any[]) => any;
|
|
101
|
-
declare function native(name: string): (...args: any[]) => any;
|
|
102
|
-
|
|
103
|
-
// Compartment?
|