@tuya-sat/sdf-main-sdk 6.2.2 → 6.2.3

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,7 +1,7 @@
1
1
  {
2
2
  "main.css": "auto/main.css",
3
3
  "main.js": "auto/main.bundle.js",
4
- "364.2d1ca926.chunk.js": "auto/364.2d1ca926.chunk.js",
4
+ "364.dcdb9c12.chunk.js": "auto/364.dcdb9c12.chunk.js",
5
5
  "static/img/login3.png": "auto/static/img/dd06d35d98047203e715.png",
6
6
  "static/img/reLogin.png": "auto/static/img/294142da390c5af23324.png",
7
7
  "static/img/login2.png": "auto/static/img/47a523d0027c7b5af83f.png",
@@ -23,5 +23,5 @@
23
23
  "static/img/tuya.png": "auto/static/img/328d8b5c342b13933c5c.png",
24
24
  "main.css.map": "auto/main.css.map",
25
25
  "main.bundle.js.map": "auto/main.bundle.js.map",
26
- "364.2d1ca926.chunk.js.map": "auto/364.2d1ca926.chunk.js.map"
26
+ "364.dcdb9c12.chunk.js.map": "auto/364.dcdb9c12.chunk.js.map"
27
27
  }
@@ -19,11 +19,24 @@ export interface PublishTopicOption {
19
19
  isRaw?: boolean;
20
20
  }
21
21
  export type MqttTopic = string | ((uid: string) => string);
22
+ export type MqttStatus = 'connected' | 'reconnecting' | 'reconnect_failed' | 'offline' | 'close' | 'error';
23
+ export interface MqttStatusEvent {
24
+ status: MqttStatus;
25
+ remainingRetries?: number;
26
+ maxRetries?: number;
27
+ error?: any;
28
+ }
29
+ export interface MqttStatusChangeOption {
30
+ /** 为 false 时记入子应用作用域,卸载微应用时会随 unsubscribeMicTopics 一起取消 */
31
+ isGlobal?: boolean;
32
+ }
33
+ export type MqttStatusListener = (event: MqttStatusEvent) => void;
22
34
  declare const mqtt: {
23
35
  init: (cb?: () => void, force?: boolean) => Promise<void>;
24
36
  subscribeTopic: (topic: MqttTopic, cbFn?: (msg: any) => void, option?: SubscribeTopicOption) => void;
25
37
  publishTopic: (topic: MqttTopic, data: any, option?: PublishTopicOption) => Promise<void>;
26
38
  unsubscribeMicTopics: () => void;
27
39
  unsubscribeTopic: (topic?: MqttTopic) => void;
40
+ onStatusChange: (listener: MqttStatusListener, option?: MqttStatusChangeOption) => () => void;
28
41
  };
29
42
  export default mqtt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-sat/sdf-main-sdk",
3
- "version": "6.2.2",
3
+ "version": "6.2.3",
4
4
  "main": "./dist/main.bundle.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",