@moddable/typings 5.0.1 → 5.2.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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2022 Shinya Ishikawa
2
+ * Copyright (c) 2022-2024 Shinya Ishikawa
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -28,9 +28,10 @@ declare module "embedded:io/socket/listener" {
28
28
  format?: "socket/tcp";
29
29
  target?: any;
30
30
  })
31
- read(): TCP
31
+ read(): TCP | undefined
32
32
  get format(): "socket/tcp"
33
33
  set format(value: "socket/tcp")
34
+ readonly port: number;
34
35
  }
35
36
  export default Listener;
36
37
  }
package/headers.d.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  declare module "headers" {
22
- class Headers extends Map<String, String> {}
22
+ class Headers extends Map<string, string> {}
23
23
 
24
24
  export { Headers as default };
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "5.0.1",
3
+ "version": "5.2.0",
4
4
  "main": "",
5
5
  "types": [
6
6
  "xs.d.ts",
package/pins/audioin.d.ts CHANGED
@@ -22,7 +22,7 @@ declare module 'pins/audioin' {
22
22
  class AudioIn {
23
23
  public constructor()
24
24
  public close(): void
25
- public read(samples: number): number
25
+ public read(sampleCount: number, buffer?: ArrayBuffer, offset?: number): ArrayBuffer
26
26
  public readonly sampleRate: number
27
27
  public readonly bitsPerSample: number
28
28
  public readonly numChannels: number
package/socket.d.ts CHANGED
@@ -86,6 +86,7 @@ declare module "socket" {
86
86
  constructor(options: ListenerOptions);
87
87
  callback: (this: Listener) => void;
88
88
  }
89
+ type Socket = RawSocket | TCPSocket | UDPSocket;
89
90
  var Socket: {
90
91
  new <T extends RawSocketOptions | TCPSocketOptions | UDPSocketOptions>(
91
92
  dictionary: T
package/wifi.d.ts CHANGED
@@ -31,8 +31,7 @@ declare module "wifi" {
31
31
  rssi: number,
32
32
  bssid: ArrayBuffer,
33
33
  } | null) => void;
34
- export type StationMode = 1;
35
- export type AccessPointMode = 2;
34
+ export type WiFiMode = -5 | 0 | 1 | 2 | 3;
36
35
  export type ScanOptions = {hidden?: boolean, channel?: number}
37
36
  export type AccessPointOptions = {
38
37
  ssid: string,
@@ -50,11 +49,17 @@ declare module "wifi" {
50
49
  static readonly disconnected: "disconnect";
51
50
  static readonly station_connected: "station_connect";
52
51
  static readonly station_disconnected: "station_disconnect";
52
+ static readonly Mode: {
53
+ off: -5,
54
+ none: 0,
55
+ station: 1,
56
+ accessPoint: 2,
57
+ };
53
58
 
54
59
  constructor(options?: WiFiOptions, callback?: WiFiCallback);
55
60
  close(): void;
56
61
  static scan(options: ScanOptions, callback: WiFiScanCallback): void;
57
- static mode: StationMode | AccessPointMode;
62
+ static mode: WiFiMode;
58
63
  static connect(options?: WiFiOptions): void;
59
64
  static disconnect(): void;
60
65
  static accessPoint(options: AccessPointOptions): void;
package/worker.d.ts CHANGED
@@ -19,21 +19,45 @@
19
19
  */
20
20
 
21
21
  declare module "worker" {
22
- export interface Self {
22
+ export interface WorkerOptions {
23
+ static?: number;
24
+ chunk?: {
25
+ initial?: number;
26
+ incremental?: number;
27
+ };
28
+ heap?: {
29
+ initial?: number;
30
+ incremental?: number;
31
+ };
32
+ stack?: number;
33
+ keys?: {
34
+ initial?: number;
35
+ incremental?: number;
36
+ name?: number;
37
+ symbol?: number;
38
+ };
39
+ }
40
+
41
+ interface MessagePort {
23
42
  onmessage(message: any): void;
24
43
  postMessage(message: any): void;
25
44
  }
26
45
 
27
- class Worker implements Self {
28
- constructor(module: string, options?: object)
29
- terminate(): void;
30
-
46
+ class Worker implements MessagePort {
47
+ constructor(module: string, options?: WorkerOptions)
31
48
  onmessage(message: any): void;
32
49
  postMessage(message: any): void;
50
+ terminate(): void;
33
51
  }
34
52
 
35
53
  export class SharedWorker {
36
54
  constructor(module: string, options?: object)
55
+ get port(): MessagePort
56
+ }
57
+
58
+
59
+ export interface Self extends MessagePort {
60
+ close(): void;
37
61
  }
38
62
 
39
63
  global {