@moddable/typings 5.9.0 → 5.10.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.
@@ -0,0 +1,103 @@
1
+ declare module "embedded:io/bluetoothle/central" {
2
+ import { Buffer } from "embedded:io/_common";
3
+
4
+ interface Advertisement {
5
+ address: string;
6
+ rssi?: number;
7
+ get name(): string | undefined;
8
+ get services(): string[] | undefined;
9
+ get manufacturerData(): { manufacturer: number, data: ArrayBuffer } | undefined;
10
+ get(adType: number): ArrayBuffer | undefined;
11
+ }
12
+
13
+ interface GAPClientFilters {
14
+ services?: string[]
15
+ }
16
+
17
+ interface GAPClientOptions {
18
+ target?: any;
19
+ filters?: GAPClientFilters;
20
+ onError?: (this: GAPClient, error: Error) => void;
21
+ onReadable?: (this: GAPClient, count: number) => void;
22
+ }
23
+
24
+ class GAPClient {
25
+ constructor(options: GAPClientOptions);
26
+ target: any;
27
+ close(): void;
28
+ read(): Advertisement;
29
+ }
30
+
31
+ interface GATTClientNotifiedValue extends ArrayBuffer {
32
+ handle: number
33
+ }
34
+
35
+ interface GATTClientWriteOptions {
36
+ response?: boolean
37
+ }
38
+
39
+ interface GATTClientOptions {
40
+ address: string,
41
+ target?: any;
42
+ onReady?: (this: GATTClient, ) => void;
43
+ onError?: (this: GATTClient, error: Error) => void;
44
+ onReadable?: (this: GATTClient, count: number) => void;
45
+ }
46
+
47
+ interface GATTClientService {
48
+ get uuid(): string;
49
+ }
50
+
51
+ interface GATTClientCharacteristic {
52
+ get uuid(): string;
53
+ get handle(): number;
54
+ get properties(): number;
55
+ }
56
+
57
+ interface GATTClientDescriptor {
58
+ get uuid(): string;
59
+ }
60
+
61
+ class GATTClient {
62
+ constructor(options: GATTClientOptions);
63
+ target: any;
64
+
65
+ close(callback?: (error?: Error) => void): void;
66
+
67
+ getPrimaryServices(callback: (error: Error | null, services: GATTClientService[]) => void): void;
68
+ getPrimaryServices(options: object, callback: (error: Error | null, services: GATTClientService[]) => void): void;
69
+
70
+ getCharacteristics(service: GATTClientService, callback: (error: Error | null, characteristics: GATTClientCharacteristic[]) => void): void;
71
+ getCharacteristics(service: GATTClientService, options: object, callback: (error: Error | null, characteristics: GATTClientCharacteristic[]) => void): void;
72
+
73
+ getDescriptors(characteristic: GATTClientCharacteristic, callback: (error: Error | null, descriptors: GATTClientDescriptor[]) => void): void;
74
+ getDescriptors(characteristic: GATTClientCharacteristic, options: object, callback: (error: Error | null, descriptors: GATTClientDescriptor[]) => void): void;
75
+
76
+ read(what: GATTClientCharacteristic | GATTClientDescriptor, callback: (error: Error | null, value: ArrayBuffer) => void): void;
77
+ read(what: GATTClientCharacteristic | GATTClientDescriptor, options: object, callback: (error: Error | null, value: ArrayBuffer) => void): void;
78
+ read() : undefined | GATTClientNotifiedValue;
79
+
80
+ write(what: GATTClientCharacteristic | GATTClientDescriptor, value: Buffer, callback?: (error: Error | null) => void): void;
81
+ write(what: GATTClientCharacteristic | GATTClientDescriptor, value: Buffer, options: GATTClientWriteOptions, callback?: (error: Error | null) => void): void;
82
+
83
+ enableNotifications(characteristic: GATTClientCharacteristic, enable: boolean, callback?: (error?: Error) => void): void;
84
+
85
+ get maximumWrite(): number;
86
+
87
+ store(item: GATTClientService | GATTClientCharacteristic | GATTClientDescriptor): ArrayBuffer;
88
+ restore(item: Buffer): GATTClientService | GATTClientCharacteristic | GATTClientDescriptor;
89
+
90
+ static readonly properties: {
91
+ authenticatedSignedWrites: 64;
92
+ broadcast: 1;
93
+ indicate: 32;
94
+ notify: 16;
95
+ read: 2;
96
+ reliableWrite: 128;
97
+ write: 8;
98
+ writeWithOutResponse: 4;
99
+ };
100
+ }
101
+
102
+ export { GATTClient, GAPClient };
103
+ }
package/mcpack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (c) 2020-2023 Moddable Tech, Inc
2
+ * Copyright (c) 2020-2025 Moddable Tech, Inc
3
3
  *
4
4
  * This file is part of the Moddable SDK Tools.
5
5
  *
@@ -18,17 +18,21 @@
18
18
  *
19
19
  */
20
20
 
21
+ import type Timer from "timer";
22
+
21
23
  interface Console {
22
24
  log(...log: (string | number | boolean)[]):void;
23
25
  }
24
- declare const console: Console;
25
26
 
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;
27
+ declare global {
28
+ const console: Console;
29
+ const clearImmediate: (timer: Timer) => void;
30
+ const clearInterval: (timer: Timer) => void;
31
+ const clearTimeout: (timer: Timer) => void;
32
+ const setImmediate: (handler: Function) => Timer;
33
+ const setInterval: (handler: Function, timeout?: number) => Timer;
34
+ const setTimeout: (handler: Function, timeout?: number) => Timer;
35
+ }
32
36
 
33
37
  // import fetch from "fetch";
34
38
  // import Headers from "headers";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moddable/typings",
3
- "version": "5.9.0",
3
+ "version": "5.10.1",
4
4
  "main": "",
5
5
  "types": [
6
6
  "xs.d.ts",
package/url.d.ts CHANGED
@@ -53,4 +53,5 @@ declare module "url" {
53
53
  [Symbol.iterator](): IterableIterator<[string, string]>;
54
54
  }
55
55
  export { URL, URLSearchParams }
56
+ export default URL;
56
57
  }
package/xs.d.ts CHANGED
@@ -65,6 +65,22 @@ interface ArrayBuffer {
65
65
  concat(...buffers: ArrayBufferLike[]): ArrayBuffer;
66
66
  }
67
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
+
68
84
  interface BigIntConstructor {
69
85
  bitLength(value: BigInt): number
70
86
  fromArrayBuffer(buffer: ArrayBufferLike): BigInt