ms-types 0.9.13 → 0.9.15
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/package.json
CHANGED
package/types/cloud.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ declare namespace cloud {
|
|
|
36
36
|
* @param event 自定义事件名称。
|
|
37
37
|
* @param data 可 JSON 序列化的普通 Object。
|
|
38
38
|
* @returns 已连接且数据可写出时返回 true。
|
|
39
|
+
* @description 设备总览状态固定使用 cloud.report("cloud:status", data) 上报;data 的 key 必须是云控端已配置的自定义字段名,多余字段不会在设备总览显示。
|
|
39
40
|
* @example
|
|
40
41
|
* cloud.report("done", { value: 1 });
|
|
41
42
|
*/
|
package/types/global.d.ts
CHANGED
|
@@ -81,13 +81,21 @@ declare const sharedState: {
|
|
|
81
81
|
/**
|
|
82
82
|
* 设置停止回调(仅主线程调用,不能在线程脚本中调用)
|
|
83
83
|
* @param callback 停止回调
|
|
84
|
-
* @description
|
|
84
|
+
* @description 脚本执行停止时调用,success 表示正常停止,error 表示异常停止,stopped 表示手动停止
|
|
85
85
|
* @example
|
|
86
|
-
* setStopCallback(() => {
|
|
87
|
-
*
|
|
86
|
+
* setStopCallback((status) => {
|
|
87
|
+
* if (status === "success") {
|
|
88
|
+
* logi("脚本执行完成");
|
|
89
|
+
* } else if (status === "error") {
|
|
90
|
+
* loge("脚本执行异常");
|
|
91
|
+
* } else if (status === "stopped") {
|
|
92
|
+
* logi("脚本手动停止");
|
|
93
|
+
* }
|
|
88
94
|
* });
|
|
89
95
|
*/
|
|
90
|
-
declare function setStopCallback(
|
|
96
|
+
declare function setStopCallback(
|
|
97
|
+
callback: (status: "success" | "error" | "stopped") => void,
|
|
98
|
+
): void;
|
|
91
99
|
|
|
92
100
|
/**
|
|
93
101
|
* 设置异常停止回调(仅主线程调用,不能在线程脚本中调用)
|
|
@@ -192,7 +200,10 @@ declare function getCpuAutoThrottle(): boolean;
|
|
|
192
200
|
* @example
|
|
193
201
|
* const delay = setCpuThrottleDelay(3, 30);
|
|
194
202
|
*/
|
|
195
|
-
declare function setCpuThrottleDelay(
|
|
203
|
+
declare function setCpuThrottleDelay(
|
|
204
|
+
minMs: number,
|
|
205
|
+
maxMs: number,
|
|
206
|
+
): { minMs: number; maxMs: number };
|
|
196
207
|
|
|
197
208
|
/**
|
|
198
209
|
* 获取 CPU 限流延迟范围(毫秒)
|
|
@@ -34,6 +34,7 @@ declare namespace $云控 {
|
|
|
34
34
|
* @param 事件 自定义事件名称。
|
|
35
35
|
* @param 数据 可 JSON 序列化的普通 Object。
|
|
36
36
|
* @returns 已连接且数据可写出时返回 true。
|
|
37
|
+
* @description 设备总览状态固定使用 $云控.上报数据("cloud:status", 数据) 上报;数据的 key 必须是云控端已配置的自定义字段名,多余字段不会在设备总览显示。
|
|
37
38
|
* @example
|
|
38
39
|
* $云控.上报数据("done", { value: 1 });
|
|
39
40
|
*/
|
|
@@ -80,13 +80,21 @@ declare const $共享状态: {
|
|
|
80
80
|
/**
|
|
81
81
|
* 设置停止回调(仅主线程调用,不能在线程脚本中调用)
|
|
82
82
|
* @param callback 停止回调
|
|
83
|
-
* @description
|
|
83
|
+
* @description 脚本执行停止时调用,success 表示正常停止,error 表示异常停止,stopped 表示手动停止
|
|
84
84
|
* @example
|
|
85
|
-
* $设置停止回调(() => {
|
|
86
|
-
*
|
|
85
|
+
* $设置停止回调((状态) => {
|
|
86
|
+
* if (状态 === "success") {
|
|
87
|
+
* $打印信息日志("脚本执行完成");
|
|
88
|
+
* } else if (状态 === "error") {
|
|
89
|
+
* $打印错误日志("脚本执行异常");
|
|
90
|
+
* } else if (状态 === "stopped") {
|
|
91
|
+
* $打印信息日志("脚本手动停止");
|
|
92
|
+
* }
|
|
87
93
|
* });
|
|
88
94
|
*/
|
|
89
|
-
declare const $设置停止回调: (
|
|
95
|
+
declare const $设置停止回调: (
|
|
96
|
+
回调: (状态: "success" | "error" | "stopped") => 无返回值,
|
|
97
|
+
) => 无返回值;
|
|
90
98
|
|
|
91
99
|
/**
|
|
92
100
|
* 设置异常停止回调(仅主线程调用,不能在线程脚本中调用)
|