@moddable/typings 1.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/Resource.d.ts +30 -0
- package/base64.d.ts +27 -0
- package/ble/hidclient.d.ts +95 -0
- package/ble/index.d.ts +1 -0
- package/ble.d.ts +732 -0
- package/commodetto/Bitmap.d.ts +53 -0
- package/commodetto/PixelsOut.d.ts +67 -0
- package/commodetto/Poco.d.ts +104 -0
- package/commodetto/index.d.ts +1 -0
- package/commodetto/outline.d.ts +101 -0
- package/commodetto/parseBMF.d.ts +34 -0
- package/commodetto/parseBMP.d.ts +25 -0
- package/commodetto/parseRLE.d.ts +25 -0
- package/commodetto/readJPEG.d.ts +39 -0
- package/console.d.ts +39 -0
- package/crc.d.ts +35 -0
- package/debug.d.ts +26 -0
- package/deepEqual.d.ts +23 -0
- package/dns/index.d.ts +1 -0
- package/dns/parser.d.ts +37 -0
- package/dns/serializer.d.ts +41 -0
- package/dns/server.d.ts +27 -0
- package/dns.d.ts +55 -0
- package/embedded_io/_common.d.ts +27 -0
- package/embedded_io/analog.d.ts +39 -0
- package/embedded_io/digital.d.ts +65 -0
- package/embedded_io/digitalbank.d.ts +56 -0
- package/embedded_io/i2c.d.ts +44 -0
- package/embedded_io/index.d.ts +1 -0
- package/embedded_io/pulsecount.d.ts +39 -0
- package/embedded_io/pwm.d.ts +38 -0
- package/embedded_io/serial.d.ts +61 -0
- package/embedded_io/smbus.d.ts +43 -0
- package/embedded_io/socket/listener.d.ts +36 -0
- package/embedded_io/socket/tcp.d.ts +51 -0
- package/embedded_io/socket/udp.d.ts +46 -0
- package/embedded_io/spi.d.ts +45 -0
- package/embedded_io/system.d.ts +36 -0
- package/embedded_provider/builtin.d.ts +57 -0
- package/embedded_provider/index.d.ts +1 -0
- package/file.d.ts +67 -0
- package/flash.d.ts +33 -0
- package/global.d.ts +9 -0
- package/hex.d.ts +27 -0
- package/http.d.ts +125 -0
- package/instrumentation.d.ts +60 -0
- package/mc/config.d.ts +24 -0
- package/mc/index.d.ts +1 -0
- package/mcpack.d.ts +41 -0
- package/mdns.d.ts +47 -0
- package/modules.d.ts +28 -0
- package/net.d.ts +67 -0
- package/package.json +14 -0
- package/ping.d.ts +38 -0
- package/pins/analog.d.ts +26 -0
- package/pins/audioin.d.ts +31 -0
- package/pins/audioout.d.ts +85 -0
- package/pins/digital/monitor.d.ts +41 -0
- package/pins/digital.d.ts +46 -0
- package/pins/i2c.d.ts +40 -0
- package/pins/index.d.ts +1 -0
- package/pins/pwm.d.ts +28 -0
- package/pins/rmt.d.ts +48 -0
- package/pins/servo.d.ts +28 -0
- package/pins/smbus.d.ts +47 -0
- package/piu/CombTransition.d.ts +25 -0
- package/piu/MC.d.ts +580 -0
- package/piu/Sound.d.ts +43 -0
- package/piu/Timeline.d.ts +50 -0
- package/piu/WipeTransition.d.ts +25 -0
- package/piu/index.d.ts +1 -0
- package/piu/shape.d.ts +43 -0
- package/preference.d.ts +29 -0
- package/securesocket.d.ts +38 -0
- package/sntp.d.ts +42 -0
- package/socket.d.ts +97 -0
- package/structuredClone.d.ts +23 -0
- package/telnet.d.ts +27 -0
- package/text/decoder.d.ts +46 -0
- package/text/encoder.d.ts +38 -0
- package/text/index.d.ts +1 -0
- package/time.d.ts +31 -0
- package/timer.d.ts +47 -0
- package/uuid.d.ts +24 -0
- package/websocket.d.ts +58 -0
- package/wifi.d.ts +61 -0
- package/worker.d.ts +44 -0
- package/xs.d.ts +89 -0
- package/zip.d.ts +29 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 Shinya Ishikawa
|
|
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 "embedded:io/system" {
|
|
22
|
+
import Timer from "timer";
|
|
23
|
+
/**
|
|
24
|
+
* @experimetnal
|
|
25
|
+
*/
|
|
26
|
+
class System {
|
|
27
|
+
static deepSleep(us: number, mode: number): void;
|
|
28
|
+
static restart(): void;
|
|
29
|
+
static resolve(name: string, callback: (name: string, ip: string) => void) : void;
|
|
30
|
+
static setTimeout: typeof Timer.set;
|
|
31
|
+
static clearTimeout: typeof Timer.clear;
|
|
32
|
+
static setInterval: typeof Timer.repeat;
|
|
33
|
+
static clearInterval: typeof Timer.clear;
|
|
34
|
+
}
|
|
35
|
+
export default System;
|
|
36
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 Shinya Ishikawa
|
|
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
|
+
|
|
22
|
+
declare module "embedded:provider/builtin" {
|
|
23
|
+
import Digital from "embedded:io/digital";
|
|
24
|
+
import DigitalBank from "embedded:io/digitalbank";
|
|
25
|
+
import Analog from "embedded:io/analog";
|
|
26
|
+
import PWM from "embedded:io/pwm";
|
|
27
|
+
import PulseCount from "embedded:io/pulsecount";
|
|
28
|
+
import I2C from "embedded:io/i2c";
|
|
29
|
+
import SMBus from "embedded:io/smbus";
|
|
30
|
+
import SPI from "embedded:io/spi";
|
|
31
|
+
import Serial from "embedded:io/serial";
|
|
32
|
+
import type { PinSpecifier } from "embedded:io/_common";
|
|
33
|
+
const device: {
|
|
34
|
+
io: {
|
|
35
|
+
Digital: typeof Digital;
|
|
36
|
+
DigitalBank: typeof DigitalBank;
|
|
37
|
+
Analog: typeof Analog;
|
|
38
|
+
PWM: typeof PWM;
|
|
39
|
+
PulseCount: typeof PulseCount;
|
|
40
|
+
I2C: typeof I2C;
|
|
41
|
+
SMBus: typeof SMBus;
|
|
42
|
+
SPI: typeof SPI;
|
|
43
|
+
Serial: typeof Serial;
|
|
44
|
+
};
|
|
45
|
+
Digital: { default: ConstructorParameters<typeof Digital>[0] };
|
|
46
|
+
DigitalBank: { default: ConstructorParameters<typeof DigitalBank>[0] };
|
|
47
|
+
Analog: { default: ConstructorParameters<typeof Analog>[0] };
|
|
48
|
+
PWM: { default: ConstructorParameters<typeof PWM>[0] };
|
|
49
|
+
PulseCount: { default: ConstructorParameters<typeof PulseCount>[0] };
|
|
50
|
+
I2C: { default: ConstructorParameters<typeof I2C>[0] };
|
|
51
|
+
SMBus: { default: ConstructorParameters<typeof SMBus>[0] };
|
|
52
|
+
SPI: { default: ConstructorParameters<typeof SPI>[0] };
|
|
53
|
+
Serial: { default: ConstructorParameters<typeof Serial>[0] };
|
|
54
|
+
pin: { [name: string]: PinSpecifier };
|
|
55
|
+
};
|
|
56
|
+
export default device;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Blank
|
package/file.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "file" {
|
|
22
|
+
/**
|
|
23
|
+
* The `File` class provides access to files.
|
|
24
|
+
*/
|
|
25
|
+
export class File {
|
|
26
|
+
constructor(path: string, write?: boolean);
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
read<T extends (
|
|
31
|
+
typeof ArrayBuffer | typeof String
|
|
32
|
+
)>(
|
|
33
|
+
type: T,
|
|
34
|
+
bytes?: number
|
|
35
|
+
): T extends typeof String ? string : InstanceType<T>;
|
|
36
|
+
|
|
37
|
+
write(
|
|
38
|
+
value: ArrayBufferLike | ArrayBuffer | string,
|
|
39
|
+
...moreValues: (ArrayBuffer | string)[]
|
|
40
|
+
): void;
|
|
41
|
+
|
|
42
|
+
close(): void;
|
|
43
|
+
|
|
44
|
+
readonly length: number;
|
|
45
|
+
position: number;
|
|
46
|
+
|
|
47
|
+
static delete(path: string): boolean;
|
|
48
|
+
static exists(path: string): boolean;
|
|
49
|
+
static rename(from: string, to: string): boolean;
|
|
50
|
+
}
|
|
51
|
+
type IteratorDirectoryEntry = {name: string, length: undefined};
|
|
52
|
+
type IteratorFileEntry = {name: string, length: number};
|
|
53
|
+
class Iterator {
|
|
54
|
+
constructor(path: string);
|
|
55
|
+
next(): IteratorDirectoryEntry | IteratorFileEntry | undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class Directory {
|
|
59
|
+
static create(path): void;
|
|
60
|
+
static delete(path): void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
class System {
|
|
64
|
+
static config(): {maxPathLength: number}
|
|
65
|
+
static info(): {used: number, total: number};
|
|
66
|
+
}
|
|
67
|
+
}
|
package/flash.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-2022 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 "flash" {
|
|
22
|
+
class Flash {
|
|
23
|
+
constructor(partition?: string);
|
|
24
|
+
constructor(offset: number, byteLength: number);
|
|
25
|
+
erase(sector: number): void;
|
|
26
|
+
read(offset: number, byteLength: number, useHostBuffer?: boolean): ArrayBuffer | HostBuffer;
|
|
27
|
+
write(offset: number, byteLength: number, buffer: BufferLike): void;
|
|
28
|
+
readonly byteLength: number;
|
|
29
|
+
readonly blockSize: number;
|
|
30
|
+
map(): HostBuffer;
|
|
31
|
+
}
|
|
32
|
+
export {Flash as default};
|
|
33
|
+
}
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import System_ from "embedded:io/system"
|
|
2
|
+
import Device from "embedded:provider/builtin"
|
|
3
|
+
|
|
4
|
+
export {}
|
|
5
|
+
declare global {
|
|
6
|
+
// NOTE: `System` is non-standard and temporary to support the IO examples. Breaking changes are possible.
|
|
7
|
+
var System: typeof System_;
|
|
8
|
+
var device: typeof Device;
|
|
9
|
+
}
|
package/hex.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "hex" {
|
|
22
|
+
var Hex: {
|
|
23
|
+
toBuffer: (str: string, separator?: string) => ArrayBuffer;
|
|
24
|
+
toString: (buffer: BufferLike, separator?: string) => string;
|
|
25
|
+
}
|
|
26
|
+
export {Hex as default};
|
|
27
|
+
}
|
package/http.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "http" {
|
|
22
|
+
import type {TCPSocketOptions, ListenerOptions} from "socket";
|
|
23
|
+
|
|
24
|
+
type RequestError = -1;
|
|
25
|
+
type RequestBodyFragment = 0;
|
|
26
|
+
type RequestStatusCode = 1;
|
|
27
|
+
type RequestHeaderReceived = 2;
|
|
28
|
+
type RequestAllHeaders = 3;
|
|
29
|
+
type RequestResponseFragment = 4;
|
|
30
|
+
type RequestAllResponse = 5;
|
|
31
|
+
|
|
32
|
+
export type RequestStatus = (
|
|
33
|
+
RequestError |
|
|
34
|
+
RequestBodyFragment |
|
|
35
|
+
RequestStatusCode |
|
|
36
|
+
RequestHeaderReceived |
|
|
37
|
+
RequestAllHeaders |
|
|
38
|
+
RequestResponseFragment |
|
|
39
|
+
RequestAllResponse
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export type HTTPRequestOptions = TCPSocketOptions | {
|
|
43
|
+
host?: string,
|
|
44
|
+
address?: string,
|
|
45
|
+
port?: number,
|
|
46
|
+
path?: string,
|
|
47
|
+
method?: string,
|
|
48
|
+
headers?: (string | number)[],
|
|
49
|
+
body?: boolean | string | ArrayBuffer,
|
|
50
|
+
response?: typeof String | typeof ArrayBuffer
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// TODO: better
|
|
54
|
+
export type HTTPRequestCallback = (message: RequestStatus, val1?: any, val2?: any) => void | number | boolean | string | ArrayBuffer;
|
|
55
|
+
|
|
56
|
+
export class Request {
|
|
57
|
+
constructor(options: HTTPRequestOptions);
|
|
58
|
+
close(): void;
|
|
59
|
+
read(): number;
|
|
60
|
+
read<T extends typeof String | typeof ArrayBuffer>(
|
|
61
|
+
type: T,
|
|
62
|
+
until?: number
|
|
63
|
+
): T extends typeof String ? string : ArrayBuffer;
|
|
64
|
+
callback: HTTPRequestCallback
|
|
65
|
+
|
|
66
|
+
static readonly requestFragment: RequestBodyFragment;
|
|
67
|
+
static readonly status: RequestStatusCode;
|
|
68
|
+
static readonly header: RequestHeaderReceived;
|
|
69
|
+
static readonly headersComplete: RequestAllHeaders;
|
|
70
|
+
static readonly responseFragment: RequestAllHeaders;
|
|
71
|
+
static readonly responseComplete: RequestAllResponse;
|
|
72
|
+
static readonly error: RequestError;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type ServerConnection = 1;
|
|
76
|
+
type ServerStatus = 2;
|
|
77
|
+
type ServerHeader = 3;
|
|
78
|
+
type ServerHeadersComplete = 4;
|
|
79
|
+
type ServerRequestFragment = 5;
|
|
80
|
+
type ServerRequestComplete = 6;
|
|
81
|
+
type ServerPrepareResponse = 8;
|
|
82
|
+
type ServerResponseFragment = 9;
|
|
83
|
+
type ServerResponseComplete = 10;
|
|
84
|
+
type ServerError = -1;
|
|
85
|
+
export type ServerMessages = (
|
|
86
|
+
ServerConnection |
|
|
87
|
+
ServerStatus |
|
|
88
|
+
ServerHeader |
|
|
89
|
+
ServerHeadersComplete |
|
|
90
|
+
ServerRequestFragment |
|
|
91
|
+
ServerRequestComplete |
|
|
92
|
+
ServerPrepareResponse |
|
|
93
|
+
ServerResponseFragment |
|
|
94
|
+
ServerResponseComplete |
|
|
95
|
+
ServerError
|
|
96
|
+
);
|
|
97
|
+
export type HTTPServerOptions = ListenerOptions;
|
|
98
|
+
// TODO: better
|
|
99
|
+
export type HTTPServerCallback = (this: Request, message: ServerMessages, val1?: any, val2?: any) => void | number | boolean | string |
|
|
100
|
+
ArrayBuffer | { status?: number, reason?: string, headers?: string[], body: true | string | ArrayBuffer };
|
|
101
|
+
|
|
102
|
+
export class Server {
|
|
103
|
+
constructor(
|
|
104
|
+
options?: HTTPServerOptions
|
|
105
|
+
);
|
|
106
|
+
close(): void;
|
|
107
|
+
read(): number;
|
|
108
|
+
read<T extends typeof String | typeof ArrayBuffer>(
|
|
109
|
+
type: T,
|
|
110
|
+
until?: number
|
|
111
|
+
): T extends typeof String ? string : ArrayBuffer;
|
|
112
|
+
callback: HTTPServerCallback
|
|
113
|
+
|
|
114
|
+
static readonly connection: ServerConnection;
|
|
115
|
+
static readonly status: ServerStatus;
|
|
116
|
+
static readonly header: ServerHeader;
|
|
117
|
+
static readonly headersComplete: ServerHeadersComplete;
|
|
118
|
+
static readonly requestFragment: ServerRequestFragment;
|
|
119
|
+
static readonly requestComplete: ServerRequestComplete;
|
|
120
|
+
static readonly prepareResponse: ServerPrepareResponse;
|
|
121
|
+
static readonly responseFragment: ServerResponseFragment;
|
|
122
|
+
static readonly responseComplete: ServerResponseComplete;
|
|
123
|
+
static readonly error: ServerError;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "instrumentation" {
|
|
22
|
+
type PixelsDrawn = 1;
|
|
23
|
+
type FramesDrawn = 2;
|
|
24
|
+
type NetworkBytesRead = 3;
|
|
25
|
+
type NetworkBytesWritten = 4;
|
|
26
|
+
type NetworkSockets = 5;
|
|
27
|
+
type Timers = 6;
|
|
28
|
+
type Files = 7;
|
|
29
|
+
type POCODisplayListUsed = 8;
|
|
30
|
+
type PIUCommandListUsed = 9;
|
|
31
|
+
type SystemFreeMemory = 10;
|
|
32
|
+
type SlotHeapSize = 11;
|
|
33
|
+
type ChunkHeapSize = 12;
|
|
34
|
+
type KeysUsed = 13;
|
|
35
|
+
type GarbageCollectionCount = 14;
|
|
36
|
+
type ModulesLoaded = 15;
|
|
37
|
+
type StackPeak = 16;
|
|
38
|
+
type InstrumentationOption = (
|
|
39
|
+
PixelsDrawn |
|
|
40
|
+
FramesDrawn |
|
|
41
|
+
NetworkBytesRead |
|
|
42
|
+
NetworkBytesWritten |
|
|
43
|
+
NetworkSockets |
|
|
44
|
+
Timers |
|
|
45
|
+
Files |
|
|
46
|
+
POCODisplayListUsed |
|
|
47
|
+
PIUCommandListUsed |
|
|
48
|
+
SystemFreeMemory |
|
|
49
|
+
SlotHeapSize |
|
|
50
|
+
ChunkHeapSize |
|
|
51
|
+
KeysUsed |
|
|
52
|
+
GarbageCollectionCount |
|
|
53
|
+
ModulesLoaded |
|
|
54
|
+
StackPeak
|
|
55
|
+
);
|
|
56
|
+
var Instrumentation: {
|
|
57
|
+
get: (what: InstrumentationOption) => number;
|
|
58
|
+
};
|
|
59
|
+
export {Instrumentation as default};
|
|
60
|
+
}
|
package/mc/config.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "mc/config" {
|
|
22
|
+
var Config: {file: {root: string}} & Record<string, any>;
|
|
23
|
+
export {Config as default};
|
|
24
|
+
}
|
package/mc/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Blank
|
package/mcpack.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2020-2023 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 Console {
|
|
22
|
+
log(...log: (string | number | boolean)[]):void;
|
|
23
|
+
}
|
|
24
|
+
declare const console: Console;
|
|
25
|
+
|
|
26
|
+
declare function clearImmediate(id: number): void;
|
|
27
|
+
declare function clearInterval(id: number): void;
|
|
28
|
+
declare function clearTimeout(id: number): void;
|
|
29
|
+
declare function setImmediate(handler: Function): void;
|
|
30
|
+
declare function setInterval(handler: Function, timeout?: number): void;
|
|
31
|
+
declare function setTimeout(handler: Function, timeout?: number): void;
|
|
32
|
+
|
|
33
|
+
// import fetch from "fetch";
|
|
34
|
+
// import Headers from "headers";
|
|
35
|
+
// import structuredClone from "structuredClone";
|
|
36
|
+
// import TextDecoder from "text/decoder";
|
|
37
|
+
// import TextEncoder from "text/encoder";
|
|
38
|
+
// import URL from "url";
|
|
39
|
+
// import { URLSearchParams } from "url";
|
|
40
|
+
// import Worker from "worker";
|
|
41
|
+
// import { SharedWorker } from "worker";
|
package/mdns.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "mdns" {
|
|
22
|
+
type MDNSService = {
|
|
23
|
+
name: string,
|
|
24
|
+
protocol: string,
|
|
25
|
+
port: number,
|
|
26
|
+
txt: Record<string, string>
|
|
27
|
+
};
|
|
28
|
+
class MDNS {
|
|
29
|
+
constructor(
|
|
30
|
+
options: {
|
|
31
|
+
hostName: string
|
|
32
|
+
}, callback?: (message: number, value?: string) => void
|
|
33
|
+
);
|
|
34
|
+
monitor(
|
|
35
|
+
service: string,
|
|
36
|
+
callback: (
|
|
37
|
+
service: string,
|
|
38
|
+
instance: MDNSService
|
|
39
|
+
) => void
|
|
40
|
+
): void;
|
|
41
|
+
add(service: MDNSService): void;
|
|
42
|
+
update(service: MDNSService): void;
|
|
43
|
+
remove(service: MDNSService): void;
|
|
44
|
+
remove(serviceType: string): void;
|
|
45
|
+
}
|
|
46
|
+
export {MDNS as default};
|
|
47
|
+
}
|
package/modules.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2022 Chris Midgley
|
|
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 "modules" {
|
|
22
|
+
export default class Modules {
|
|
23
|
+
static has(name: string): boolean;
|
|
24
|
+
static importNow(name: string): unknown;
|
|
25
|
+
static get host(): string[];
|
|
26
|
+
static get archive(): string[];
|
|
27
|
+
}
|
|
28
|
+
}
|
package/net.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2019-2020 Bradley Farias
|
|
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 "net" {
|
|
22
|
+
/**
|
|
23
|
+
* The Net class provides access to status information about the active network connection.
|
|
24
|
+
*/
|
|
25
|
+
var Net: {
|
|
26
|
+
/**
|
|
27
|
+
* The IP address of the network connection as a `String`, e.g. "10.0.1.4"
|
|
28
|
+
*/
|
|
29
|
+
get(what: "IP"): string;
|
|
30
|
+
/**
|
|
31
|
+
* The MAC address of the device as a `String`, e.g. "A4:D1:8C:DB:C0:20"
|
|
32
|
+
*/
|
|
33
|
+
get(what: "MAC"): string;
|
|
34
|
+
/**
|
|
35
|
+
* The name of the Wi-Fi access point as a `String`, e.g. "Moddable Wi-Fi"
|
|
36
|
+
*/
|
|
37
|
+
get(what: "SSID"): string;
|
|
38
|
+
/**
|
|
39
|
+
* The MAC address of the Wi-Fi access point as a `String`, e.g. "18:64:72:47:d4:32"
|
|
40
|
+
*/
|
|
41
|
+
get(what: "BSSID"): string;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the Wi-Fi [received signal strength](https://en.wikipedia.org/wiki/Received_signal_strength_indication) as a `Number`
|
|
44
|
+
*/
|
|
45
|
+
get(what: "RSSI"): number;
|
|
46
|
+
/**
|
|
47
|
+
* Gets an Array of the DNS servers configured in the system
|
|
48
|
+
*/
|
|
49
|
+
get(what: "DNS"): string[];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The resolve function performs performs an asynchronous DNS look-up for the specified host and invokes the callback to deliver the result.
|
|
53
|
+
*
|
|
54
|
+
* The IP address is provided as a String in dotted IP address notation. If host cannot be resolved, the address parameter is undefined.
|
|
55
|
+
*
|
|
56
|
+
* The DNS implementation in lwIP supports a limited number of simultaneous DNS look-ups. The number depends on the specific platform deployment. On the ESP8266 it is 4. If the DNS resolve queue is full, resolve throws an exception.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
Net.resolve("moddable.tech", (name, address) => trace(`${name} IP address is ${address}\n`);
|
|
60
|
+
*/
|
|
61
|
+
resolve(
|
|
62
|
+
name: string,
|
|
63
|
+
callback: (name: string, address?: string) => void
|
|
64
|
+
): void;
|
|
65
|
+
}
|
|
66
|
+
export {Net as default};
|
|
67
|
+
}
|