mm_expand 2.4.1 → 2.4.2

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.
Files changed (2) hide show
  1. package/lib/eventer.js +18 -2
  2. package/package.json +1 -1
package/lib/eventer.js CHANGED
@@ -640,8 +640,12 @@ Eventer.prototype._createTask = function (o, full_key) {
640
640
  cancel: () => { cancelled = true; }
641
641
  };
642
642
 
643
- // 添加到进行中的任务列表
643
+ // 添加到进行中的任务列表(防御性处理重入调用导致 key 已被清理的情况)
644
644
  let tasks = this._tasks.get(full_key);
645
+ if (!tasks) {
646
+ tasks = [];
647
+ this._tasks.set(full_key, tasks);
648
+ }
645
649
  tasks.push(task);
646
650
 
647
651
  return { task, tasks, cancelled };
@@ -780,6 +784,10 @@ Eventer.prototype._createWaterfallTask = function (obj, full_key) {
780
784
  };
781
785
 
782
786
  let tasks = this._tasks.get(full_key);
787
+ if (!tasks) {
788
+ tasks = [];
789
+ this._tasks.set(full_key, tasks);
790
+ }
783
791
  tasks.push(task);
784
792
 
785
793
  return { task, tasks, cancelled };
@@ -900,6 +908,10 @@ Eventer.prototype._createRaceTask = function (obj, full_key) {
900
908
  };
901
909
 
902
910
  let tasks = this._tasks.get(full_key);
911
+ if (!tasks) {
912
+ tasks = [];
913
+ this._tasks.set(full_key, tasks);
914
+ }
903
915
  tasks.push(task);
904
916
 
905
917
  return { task, tasks, cancelled };
@@ -969,8 +981,12 @@ Eventer.prototype._createParallelTask = function (obj, full_key) {
969
981
  cancel: () => { cancelled = true; }
970
982
  };
971
983
 
972
- // 添加到进行中的任务列表
984
+ // 添加到进行中的任务列表(防御性处理重入调用导致 key 已被清理的情况)
973
985
  let tasks = this._tasks.get(full_key);
986
+ if (!tasks) {
987
+ tasks = [];
988
+ this._tasks.set(full_key, tasks);
989
+ }
974
990
  tasks.push(task);
975
991
 
976
992
  return { task, tasks, cancelled };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "超级美眉原型函数扩展模块 - 增强的字符串、数组、对象、日期操作,具备错误预防功能并简化业务逻辑",
5
5
  "main": "index.js",
6
6
  "scripts": {