@ives_xxz/framework 1.3.2 → 1.3.4

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/FW.d.ts CHANGED
@@ -1122,7 +1122,7 @@ declare namespace FW {
1122
1122
  * 移除任务
1123
1123
  * @param taskId
1124
1124
  */
1125
- removeTask(taskId: number): void;
1125
+ stopTask(taskId: number): void;
1126
1126
  /**
1127
1127
  * 获取所有任务
1128
1128
  */
package/Framework.ts CHANGED
@@ -67,8 +67,6 @@ class Framework {
67
67
  public getComponents<T>(serviceIdentifier: FW.ServiceIdentifier<T>): T[] {
68
68
  const binder = (this.container as any)._bindingDictionary;
69
69
  const map = binder._map;
70
-
71
- // 获取所有可能的子类绑定
72
70
  const childBindings: interfaces.Binding<T>[] = [];
73
71
  for (const [key, bindings] of map.entries()) {
74
72
  for (const binding of bindings) {
@@ -97,13 +95,15 @@ class Framework {
97
95
  */
98
96
  register(data: FW.RegisterFramework) {
99
97
  const classes = [data.logic, data.data, data.config, data.sender, data.handle];
100
-
98
+ FWLog.debug('framework注册->', classes);
101
99
  classes.forEach((cls, index) => {
102
100
  if (cls && !this.container.isBound(cls)) {
101
+ FWLog.debug('framework容器绑定成功->', cls);
103
102
  this.container.bind(cls).toSelf().inSingletonScope();
104
103
  this.container.bind(this.getKey(data.bundleName, index)).toService(cls);
105
104
  }
106
105
  });
106
+ FWLog.debug('framework注册完成->', this.container);
107
107
  }
108
108
  /**
109
109
  * 注销数据
@@ -112,18 +112,21 @@ class Framework {
112
112
  */
113
113
  unRegister(data: FW.RegisterFramework) {
114
114
  const classes = [data.logic, data.data, data.config, data.sender, data.handle];
115
-
115
+ FWLog.debug('framework注销->', classes);
116
116
  classes.forEach((cls, index) => {
117
117
  const key = this.getKey(data.bundleName, index);
118
118
  if (cls && this.container.isBound(cls)) {
119
119
  this.container.get(key)['onDestroy']?.();
120
120
  this.container.unbind(cls);
121
+ FWLog.debug('framework容器解开绑定->', cls);
121
122
  }
122
123
  if (this.container.isBound(key)) {
123
124
  this.container.get(key)['onDestroy']?.();
124
125
  this.container.unbind(this.getKey(data.bundleName, index));
126
+ FWLog.debug('framework容器解开绑定->', this.getKey(data.bundleName, index));
125
127
  }
126
128
  });
129
+ FWLog.debug('framework注销完成->', this.container);
127
130
  }
128
131
 
129
132
  private getKey(bundleName: string, tag: FWSystemDefine.FWBindTag) {
@@ -28,7 +28,8 @@ export default class FWTaskManager extends FWManager implements FW.TaskManager {
28
28
  return this.tasks.get(taskId);
29
29
  }
30
30
 
31
- removeTask(taskId: number): void {
31
+ stopTask(taskId: number): void {
32
+ this.tasks.get(taskId)?.stop();
32
33
  this.tasks.delete(taskId);
33
34
  }
34
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/utils/FWTask.ts CHANGED
@@ -68,6 +68,14 @@ export default class FWTask implements FW.Task {
68
68
  return this;
69
69
  }
70
70
 
71
+ stop(): void {
72
+ this.taskCounter = 0;
73
+ this.taskQueue = [];
74
+ this.taskStartTime = '';
75
+ this.tasksFrameCount = 0;
76
+ this.totalTaskDuration = 0;
77
+ }
78
+
71
79
  pause(): void {
72
80
  this.isPaused = true;
73
81
  this.status = FWSystemDefine.FWTaskStatus.PAUSED;