@vtj/base 0.12.0-alpha.1 → 0.12.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/base",
3
3
  "private": false,
4
- "version": "0.12.0-alpha.1",
4
+ "version": "0.12.1",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
package/types/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from './data';
8
8
  export * from './lz-string';
9
9
  export * from './mitt';
10
10
  export * from './path-to-regexp';
11
+ export * from './queue';
@@ -0,0 +1,44 @@
1
+ export declare class Queue {
2
+ private queue;
3
+ private isProcessing;
4
+ private results;
5
+ private cache;
6
+ private pendingTasks;
7
+ /**
8
+ * 添加任务到队列
9
+ * @param key 任务唯一标识符(用于缓存)
10
+ * @param task 要执行的任务函数
11
+ * @returns 任务结果的Promise
12
+ */
13
+ add<T>(key: string | symbol, task: () => Promise<T>): Promise<T>;
14
+ /**
15
+ * 获取所有已完成任务的结果
16
+ * @returns 所有任务结果的副本
17
+ */
18
+ getAllResults(): {
19
+ key: string | symbol;
20
+ status: "fulfilled" | "rejected";
21
+ value?: any;
22
+ reason?: any;
23
+ }[];
24
+ /**
25
+ * 获取特定任务的结果
26
+ * @param key 任务键
27
+ * @returns 任务结果或undefined
28
+ */
29
+ getResult(key: string | symbol): {
30
+ status: "fulfilled" | "rejected";
31
+ value?: any;
32
+ reason?: any;
33
+ };
34
+ /**
35
+ * 清除特定任务的缓存
36
+ * @param key 要清除的任务键
37
+ */
38
+ clearCacheForKey(key: string | symbol): void;
39
+ /**
40
+ * 清除所有缓存
41
+ */
42
+ clearAllCache(): void;
43
+ private processQueue;
44
+ }