@ives_xxz/framework 1.6.1 → 1.6.3

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
@@ -1170,6 +1170,7 @@ declare namespace FW {
1170
1170
  enable?: boolean;
1171
1171
  responseTime?: number;
1172
1172
  lastResponseTimestamp?: number;
1173
+ data?: any;
1173
1174
  };
1174
1175
 
1175
1176
  type FWEvent = {
@@ -1,11 +1,8 @@
1
- import { FWSystemDefine } from "../define/FWSystemDefine";
2
- import FWLayer from "../layer/FWLayer";
3
- import { FWLayerData } from "../manager/FWLayerManager";
4
- import { FrameworkBase } from "../FrameworkBase";
5
- export abstract class FWLayerController
6
- extends FrameworkBase
7
- implements FW.LayerController
8
- {
1
+ import { FWSystemDefine } from '../define/FWSystemDefine';
2
+ import FWLayer from '../layer/FWLayer';
3
+ import { FWLayerData } from '../manager/FWLayerManager';
4
+ import { FrameworkBase } from '../FrameworkBase';
5
+ export abstract class FWLayerController extends FrameworkBase implements FW.LayerController {
9
6
  readonly entry: FW.Entry = FW.Entry;
10
7
  /** layer数据 */
11
8
  layerData: FWLayerData;
@@ -78,20 +75,16 @@ export abstract class FWLayerController
78
75
  referenceNode: cc.Node,
79
76
  type?: {
80
77
  prototype: T;
81
- }
78
+ },
82
79
  ) {
83
80
  return this.find(path, referenceNode)?.getComponent<T>(type);
84
81
  }
85
82
 
86
- getComponentsInChildren<T extends cc.Component = cc.Component>(type: {
87
- prototype: T;
88
- }) {
83
+ getComponentsInChildren<T extends cc.Component = cc.Component>(type: { prototype: T }) {
89
84
  return this.layer.getComponentsInChildren(type);
90
85
  }
91
86
 
92
- getComponentInChildren<T extends cc.Component = cc.Component>(type: {
93
- prototype: T;
94
- }) {
87
+ getComponentInChildren<T extends cc.Component = cc.Component>(type: { prototype: T }) {
95
88
  return this.layer.getComponentInChildren(type);
96
89
  }
97
90
 
@@ -100,16 +93,12 @@ export abstract class FWLayerController
100
93
  */
101
94
  registerEvent(args: FW.RegisterArgs): void {
102
95
  args.target = args.target || this;
103
- args.CCEvent?.forEach(
104
- (v) => (v.responseInterval = this.defaultResponseInterval)
105
- );
106
- args.FWEvent?.forEach(
107
- (v) => (v.responseInterval = this.defaultResponseInterval)
108
- );
96
+ args.CCEvent?.forEach((v) => (v.responseInterval = this.defaultResponseInterval));
97
+ args.FWEvent?.forEach((v) => (v.responseInterval = this.defaultResponseInterval));
109
98
  return this.entry.uiMgr.register({
110
99
  target: this,
111
- CCEvent: args?.CCEvent ? args?.CCEvent : [],
112
- FWEvent: args?.FWEvent ? args?.FWEvent : [],
100
+ CCEvent: args?.CCEvent || undefined,
101
+ FWEvent: args?.FWEvent || undefined,
113
102
  });
114
103
  }
115
104
 
@@ -117,7 +106,7 @@ export abstract class FWLayerController
117
106
  target: cc.Node,
118
107
  cb: (event: cc.Event) => void,
119
108
  responseInterval?: number,
120
- eventName?: string
109
+ eventName?: string,
121
110
  ): this {
122
111
  this.registerEvent({
123
112
  target: this,
@@ -138,7 +127,7 @@ export abstract class FWLayerController
138
127
  eventName: string,
139
128
  cb: (event: cc.Event) => void,
140
129
  target?: cc.Node,
141
- responseInterval?: number
130
+ responseInterval?: number,
142
131
  ): this {
143
132
  this.registerEvent({
144
133
  target: target || this,
@@ -336,10 +336,15 @@ export function AutoRegisterCCEvent(nodePath: string, eventName?: string) {
336
336
  }
337
337
 
338
338
  if (targetNode) {
339
- this.registerCCEvent(evt, {
340
- cb: originalMethod.bind(this),
341
- target: targetNode,
342
- });
339
+ this.registerEvent({
340
+ CCEvent: [
341
+ {
342
+ eventName: evt,
343
+ cb: originalMethod.bind(this),
344
+ target: targetNode,
345
+ }
346
+ ]
347
+ });
343
348
  FWLog.debug(`自动注册事件: ${nodePath} -> ${propertyKey}`);
344
349
  } else {
345
350
  FWLog.warn(`自动注册事件失败: 未找到节点 ${nodePath}`);
@@ -359,10 +364,15 @@ export function AutoRegisterFWEvent(eventName: any) {
359
364
 
360
365
  target.onInit = function (...args) {
361
366
  originalOnInit?.call(this, args);
362
- this.registerCCEvent(eventName, {
363
- cb: originalMethod.bind(this),
364
- target: this,
365
- });
367
+ this.registerEvent({
368
+ CCEvent: [
369
+ {
370
+ eventName: eventName,
371
+ cb: originalMethod.bind(this),
372
+ target: this,
373
+ }
374
+ ]
375
+ });
366
376
  };
367
377
  };
368
378
  }
@@ -38,14 +38,17 @@ export default abstract class FWLanguage extends cc.Component {
38
38
  }
39
39
 
40
40
  protected onLoad(): void {
41
- FW.Entry.evtMgr.register(
42
- FWEventDefine.LanguageEvent.LANGUAGE_CHANGE,
43
- () => {
41
+ this.registerEvent({
42
+ FWEvent: [
43
+ {
44
+ eventName: FWEventDefine.LanguageEvent.LANGUAGE_CHANGE,
45
+ cb: () => {
44
46
  this._language = FW.Entry.languageMgr.getLanguageIndex();
45
47
  this.onLanguageChange();
46
- },
47
- this
48
- );
48
+ }
49
+ }
50
+ ]
51
+ });
49
52
  }
50
53
 
51
54
  protected onEnable(): void {
@@ -61,6 +61,7 @@ export default class FWPromiseManager
61
61
  }
62
62
 
63
63
  const onAbort = () => {
64
+ FWLog.debug("promise abort");
64
65
  timerSchedule?.unSchedule();
65
66
  if (promiseProxy.status === FWSystemDefine.FWPromiseStatus.PENDING) {
66
67
  promiseProxy.status = FWSystemDefine.FWPromiseStatus.CANCELLED;
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
- "keywords": [
7
- "123456"
8
- ],
6
+ "keywords": ["123456"],
9
7
  "author": "ives",
10
8
  "license": "ISC"
11
9
  }
@@ -77,7 +77,9 @@ export default class FWHttp extends FWService {
77
77
  ...FWSystemConfig.PromiseConfig.http,
78
78
  retryCondition(error, retryCount) {
79
79
  return (
80
- xhr.readyState != 4 || (xhr.status !== 200 && retryCount < 3)
80
+ error ||
81
+ xhr.readyState != 4 ||
82
+ (xhr.status !== 200 && retryCount < 3)
81
83
  );
82
84
  },
83
85
  }