@moddable/typings 1.0.1 → 4.9.5

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.
Files changed (3) hide show
  1. package/mcpack.d.ts +41 -0
  2. package/package.json +1 -2
  3. package/xs.d.ts +89 -0
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/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "1.0.1",
4
- "dependencies": {},
3
+ "version": "4.9.5",
5
4
  "main": "",
6
5
  "types": [
7
6
  "xs.d.ts",
package/xs.d.ts ADDED
@@ -0,0 +1,89 @@
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 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 BufferTypes extends ArrayBufferTypes {
39
+ Uint8Array: Uint8Array,
40
+ Uint8ClampedArray: Uint8ClampedArray,
41
+ Int8Array: Int8Array,
42
+ DataView: DataView
43
+ }
44
+
45
+ type BufferLike = BufferTypes[keyof BufferTypes];
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 BigIntConstructor {
69
+ bitLength(value: BigInt): number
70
+ fromArrayBuffer(buffer: ArrayBufferLike): BigInt
71
+ }
72
+
73
+ // integer math proposal
74
+ interface Math {
75
+ idiv(a: number, b: number): number
76
+ imod(a: number, b: number): number
77
+ imuldiv(a: number, b: number, c: number): number
78
+ irandom(a: number, b: number): number
79
+ irem(a: number, b: number): number
80
+ mod(a: number, b: number): number
81
+ }
82
+
83
+ // already defined by TypeScript (because Web)
84
+ // interface Error {
85
+ // stack: string
86
+ // }
87
+
88
+
89
+ // Compartment?