@zwa73/utils 1.0.83 → 1.0.85

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.
@@ -104,6 +104,10 @@ export declare class UtilFunc {
104
104
  * @returns 处理结果
105
105
  */
106
106
  static queueProc<T>(flag: Keyable, task: (() => Promise<T>) | Promise<T>): Promise<T>;
107
+ /**队列获取目标的代办事件数
108
+ * @param flag - 队列标签
109
+ */
110
+ static queueLength(flag: Keyable): number;
107
111
  /**创建一个Outcome */
108
112
  static outcome<K extends Keyable, V>(key: K, value: V): Outcome<K, V>;
109
113
  /**处理联合值
@@ -326,6 +326,13 @@ class UtilFunc {
326
326
  tryRes();
327
327
  }
328
328
  }
329
+ /**队列获取目标的代办事件数
330
+ * @param flag - 队列标签
331
+ */
332
+ static queueLength(flag) {
333
+ const pd = this.pendingMap[flag];
334
+ return pd != null ? pd.length : 0;
335
+ }
329
336
  /**创建一个Outcome */
330
337
  static outcome(key, value) {
331
338
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "description": "my utils",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@ const infoTable = {
30
30
  }
31
31
 
32
32
  async function main(){
33
- const dataPath = path.join(__dirname,"..","version.json");
33
+ const dataPath = path.join(__dirname,"..","..","version.json");
34
34
  UtilFT.ensurePathExists(dataPath);
35
35
  const dataTable = UtilFT.loadJSONFileSync(dataPath,{});
36
36
  dataTable.utils = dataTable.utils??{};
@@ -384,6 +384,13 @@ static async queueProc<T>(flag:Keyable,task:(()=>Promise<T>)|Promise<T>):Promise
384
384
  tryRes();
385
385
  }
386
386
  }
387
+ /**队列获取目标的代办事件数
388
+ * @param flag - 队列标签
389
+ */
390
+ static queueLength(flag:Keyable){
391
+ const pd = this.pendingMap[flag]
392
+ return pd!=null ? pd.length : 0;
393
+ }
387
394
 
388
395
 
389
396