ms-types 0.0.26 → 0.0.28
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 +1 -1
- package/types/image.d.ts +8 -0
- package/types/system.d.ts +23 -2
- package/types/utils.d.ts +0 -8
package/package.json
CHANGED
package/types/image.d.ts
CHANGED
|
@@ -70,6 +70,14 @@ declare namespace image {
|
|
|
70
70
|
* image.release(imageId)
|
|
71
71
|
*/
|
|
72
72
|
function readImage(path: string): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* 读取资源图片
|
|
75
|
+
* @param fileName 文件名
|
|
76
|
+
* @returns 图片id ,如果读取失败则返回null
|
|
77
|
+
* @example
|
|
78
|
+
* image.readResImage("test.png")
|
|
79
|
+
*/
|
|
80
|
+
function readResImage(fileName: string): string | null;
|
|
73
81
|
/**
|
|
74
82
|
* 旋转图片
|
|
75
83
|
* @param imageId 图片id
|
package/types/system.d.ts
CHANGED
|
@@ -132,15 +132,16 @@ declare namespace system {
|
|
|
132
132
|
function notify(msg: string, title: string, id: string): void;
|
|
133
133
|
/**
|
|
134
134
|
* 获取内存使用信息
|
|
135
|
-
* @returns
|
|
135
|
+
* @returns 内存使用信息,包含已使用内存、可用内存、总内存和使用率(单位:MB)
|
|
136
136
|
* @example
|
|
137
137
|
* const memInfo = system.getMemoryInfo()
|
|
138
|
-
* logger.info(`已使用: ${memInfo.used}MB, 可用: ${memInfo.available}MB, 总计: ${memInfo.total}MB
|
|
138
|
+
* logger.info(`已使用: ${memInfo.used}MB, 可用: ${memInfo.available}MB, 总计: ${memInfo.total}MB, 使用率: ${memInfo.usagePercentage}%`)
|
|
139
139
|
*/
|
|
140
140
|
function getMemoryInfo(): {
|
|
141
141
|
used: number;
|
|
142
142
|
available: number;
|
|
143
143
|
total: number;
|
|
144
|
+
usagePercentage: number;
|
|
144
145
|
};
|
|
145
146
|
/**
|
|
146
147
|
* 获取已使用内存
|
|
@@ -158,6 +159,14 @@ declare namespace system {
|
|
|
158
159
|
* logger.info(`可用内存: ${availableMemory}MB`)
|
|
159
160
|
*/
|
|
160
161
|
function getAvailableMemory(): number;
|
|
162
|
+
/**
|
|
163
|
+
* 获取系统总内存
|
|
164
|
+
* @returns 系统总内存大小(单位:MB)
|
|
165
|
+
* @example
|
|
166
|
+
* const totalMemory = system.getTotalMemory()
|
|
167
|
+
* logger.info(`系统总内存: ${totalMemory}MB`)
|
|
168
|
+
*/
|
|
169
|
+
function getTotalMemory(): number;
|
|
161
170
|
/**
|
|
162
171
|
* 启动 WDA 服务
|
|
163
172
|
* @returns 是否启动成功
|
|
@@ -168,4 +177,16 @@ declare namespace system {
|
|
|
168
177
|
* }
|
|
169
178
|
*/
|
|
170
179
|
function startWDA(): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* 获取 WDA 状态
|
|
182
|
+
* @returns WDA 是否正在运行
|
|
183
|
+
* @example
|
|
184
|
+
* const isRunning = system.getWDAStatus()
|
|
185
|
+
* if (isRunning) {
|
|
186
|
+
* logger.info("WDA 服务正在运行")
|
|
187
|
+
* } else {
|
|
188
|
+
* logger.info("WDA 服务未运行")
|
|
189
|
+
* }
|
|
190
|
+
*/
|
|
191
|
+
function getWDAStatus(): boolean;
|
|
171
192
|
}
|
package/types/utils.d.ts
CHANGED
|
@@ -18,14 +18,6 @@ declare namespace utils {
|
|
|
18
18
|
* utils.readResFile("test.txt")
|
|
19
19
|
*/
|
|
20
20
|
function readResFile(fileName: string): string | null;
|
|
21
|
-
/**
|
|
22
|
-
* 读取资源图片
|
|
23
|
-
* @param fileName 文件名
|
|
24
|
-
* @returns 返回 image 模块的 imageId
|
|
25
|
-
* @example
|
|
26
|
-
* utils.readResImage("test.png")
|
|
27
|
-
*/
|
|
28
|
-
function readResImage(fileName: string): string | null;
|
|
29
21
|
/**
|
|
30
22
|
* 生成随机数
|
|
31
23
|
* @param min 最小值
|