@ives_xxz/framework 2.0.8 → 2.0.10
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/manager/FWPromiseManager.ts +1 -5
- package/package.json +2 -4
- package/service/socket/FWSocket.ts +45 -31
- package/types/FW.d.ts +94 -171
|
@@ -53,10 +53,7 @@ export default class FWPromiseManager extends FWManager implements FW.PromiseMan
|
|
|
53
53
|
const onAbort = () => {
|
|
54
54
|
FW.Log.debug('promise abort');
|
|
55
55
|
timerSchedule?.unSchedule();
|
|
56
|
-
|
|
57
|
-
promiseProxy.status = FW.SystemDefine.FWPromiseStatus.CANCELLED;
|
|
58
|
-
this.removePromise(id);
|
|
59
|
-
}
|
|
56
|
+
this.removePromise(id);
|
|
60
57
|
};
|
|
61
58
|
|
|
62
59
|
if (abortController.signal.aborted) {
|
|
@@ -67,7 +64,6 @@ export default class FWPromiseManager extends FWManager implements FW.PromiseMan
|
|
|
67
64
|
abortController.signal.addEventListener('abort', onAbort);
|
|
68
65
|
|
|
69
66
|
const wrappedResolve = (value: T | PromiseLike<T>) => {
|
|
70
|
-
promiseProxy.status = FW.SystemDefine.FWPromiseStatus.FULFILLED;
|
|
71
67
|
abortController.signal.removeEventListener('abort', onAbort);
|
|
72
68
|
this.removePromise(id);
|
|
73
69
|
timerSchedule?.unSchedule();
|
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ives_xxz/framework",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FWSystemConfig } from
|
|
2
|
-
import FWService from
|
|
1
|
+
import { FWSystemConfig } from "../../config/FWSystemConfig";
|
|
2
|
+
import FWService from "../FWService";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* TODO 犹豫socket没有改版暂时已老的cmd字符串映射方式做,后期优化
|
|
@@ -12,9 +12,9 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
12
12
|
/** socket */
|
|
13
13
|
socket: WebSocket = null;
|
|
14
14
|
/** 消息发送者 */
|
|
15
|
-
protected socketSender: FW.
|
|
15
|
+
protected socketSender: FW.Sender;
|
|
16
16
|
/** 消息处理者 */
|
|
17
|
-
protected socketHandle: FW.
|
|
17
|
+
protected socketHandle: FW.Handle;
|
|
18
18
|
/** 重连次数 */
|
|
19
19
|
protected reconnectTimes: number;
|
|
20
20
|
/** 心跳间隔时间 */
|
|
@@ -62,9 +62,9 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
62
62
|
createSocket(
|
|
63
63
|
address: string,
|
|
64
64
|
tag: string,
|
|
65
|
-
socketSender: FW.
|
|
66
|
-
socketHandle: FW.
|
|
67
|
-
config: FW.SocketConfig
|
|
65
|
+
socketSender: FW.Sender,
|
|
66
|
+
socketHandle: FW.Handle,
|
|
67
|
+
config: FW.SocketConfig
|
|
68
68
|
): FW.SocketPromiseProxy {
|
|
69
69
|
try {
|
|
70
70
|
FW.Entry.timeMgr.unSchedule(this);
|
|
@@ -108,10 +108,14 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
108
108
|
this.heartInternal = config?.heartInternal || defaultConfig.heartInternal;
|
|
109
109
|
this.heartTimeout = config?.heartTimeout || defaultConfig.heartTimeout;
|
|
110
110
|
this.heartWeakTime = config?.heartWeakTime || defaultConfig.heartWeakTime;
|
|
111
|
-
this.maxReconnectTimes =
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
111
|
+
this.maxReconnectTimes =
|
|
112
|
+
config?.maxReconnectTimes || defaultConfig.maxReconnectTimes;
|
|
113
|
+
this.reconnectInternal =
|
|
114
|
+
config?.reconnectInternal || defaultConfig.reconnectInternal;
|
|
115
|
+
this.protocolSymbol =
|
|
116
|
+
config?.protocolSymbol || defaultConfig.protocolSymbol;
|
|
117
|
+
this.protocolPollingTime =
|
|
118
|
+
config?.protocolPollingTime || defaultConfig.protocolPollingTime;
|
|
115
119
|
|
|
116
120
|
this.promiseProxy = {
|
|
117
121
|
promise: undefined,
|
|
@@ -125,7 +129,7 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
125
129
|
|
|
126
130
|
return this.promiseProxy;
|
|
127
131
|
} catch (e) {
|
|
128
|
-
FW.Log.error(
|
|
132
|
+
FW.Log.error("创建socket失败:", e);
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
/**
|
|
@@ -191,7 +195,7 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
191
195
|
if (force) this.reconnectTimes = 0;
|
|
192
196
|
|
|
193
197
|
FW.Log.debug(
|
|
194
|
-
`socket reconnect : reconnectTimes->${this.reconnectTimes},maxReconnectTimes->${this.maxReconnectTimes}
|
|
198
|
+
`socket reconnect : reconnectTimes->${this.reconnectTimes},maxReconnectTimes->${this.maxReconnectTimes}`
|
|
195
199
|
);
|
|
196
200
|
if (++this.reconnectTimes >= this.maxReconnectTimes) {
|
|
197
201
|
this.socketHandle?.onTimeout?.();
|
|
@@ -202,16 +206,22 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
202
206
|
this.socket?.close();
|
|
203
207
|
this.socket = null;
|
|
204
208
|
|
|
205
|
-
this.createSocket(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
this.createSocket(
|
|
210
|
+
this.address,
|
|
211
|
+
this.tag,
|
|
212
|
+
this.socketSender,
|
|
213
|
+
this.socketHandle,
|
|
214
|
+
{
|
|
215
|
+
heartInternal: this.heartInternal,
|
|
216
|
+
heartTimeout: this.heartTimeout,
|
|
217
|
+
heartWeakTime: this.heartWeakTime,
|
|
218
|
+
maxReconnectTimes: this.maxReconnectTimes,
|
|
219
|
+
reconnectInternal: this.reconnectInternal,
|
|
220
|
+
protocolSymbol: this.protocolSymbol,
|
|
221
|
+
protocolPollingTime: this.protocolPollingTime,
|
|
222
|
+
certificate: this.certificate,
|
|
223
|
+
}
|
|
224
|
+
);
|
|
215
225
|
}
|
|
216
226
|
|
|
217
227
|
async send(msg: string) {
|
|
@@ -221,7 +231,8 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
221
231
|
const protocolKey = this.socketSender.getProtocolKey?.(msg);
|
|
222
232
|
if (protocolKey) {
|
|
223
233
|
const symbol = Symbol(protocolKey);
|
|
224
|
-
const registry =
|
|
234
|
+
const registry =
|
|
235
|
+
this.protocolRegistry.get(protocolKey) || new Set<Symbol>();
|
|
225
236
|
const protocolPolling: FW.ProtocolPolling = {
|
|
226
237
|
msg: msg,
|
|
227
238
|
schedule: FW.Entry.timeMgr.schedule(
|
|
@@ -230,7 +241,7 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
230
241
|
},
|
|
231
242
|
this.protocolPollingTime,
|
|
232
243
|
cc.macro.REPEAT_FOREVER,
|
|
233
|
-
this
|
|
244
|
+
this
|
|
234
245
|
),
|
|
235
246
|
};
|
|
236
247
|
this.protocolRegistry.set(protocolKey, registry.add(symbol));
|
|
@@ -242,7 +253,7 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
242
253
|
|
|
243
254
|
/** 连接打开 */
|
|
244
255
|
private onSocketOpen() {
|
|
245
|
-
FW.Log.debug(
|
|
256
|
+
FW.Log.debug("on open!");
|
|
246
257
|
FW.Entry.timeMgr.unSchedule(this);
|
|
247
258
|
this.reconnectTimes = 0;
|
|
248
259
|
this.sendHeartTimestamp = 0;
|
|
@@ -267,7 +278,7 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
267
278
|
},
|
|
268
279
|
this.heartInternal / 1000,
|
|
269
280
|
cc.macro.REPEAT_FOREVER,
|
|
270
|
-
this
|
|
281
|
+
this
|
|
271
282
|
);
|
|
272
283
|
}
|
|
273
284
|
|
|
@@ -286,17 +297,20 @@ export default class FWSocket extends FWService implements FW.Socket {
|
|
|
286
297
|
|
|
287
298
|
/** socket关闭 */
|
|
288
299
|
private onSocketClose() {
|
|
289
|
-
FW.Log.debug(
|
|
300
|
+
FW.Log.debug("on close!");
|
|
290
301
|
this.socketHandle?.onClose?.();
|
|
291
302
|
FW.Entry.timeMgr.scheduleOnce(
|
|
292
303
|
() => {
|
|
293
|
-
if (
|
|
294
|
-
|
|
304
|
+
if (
|
|
305
|
+
this.getReadyState() == WebSocket.CLOSING ||
|
|
306
|
+
this.getReadyState() == WebSocket.CLOSED
|
|
307
|
+
) {
|
|
308
|
+
FW.Log.debug("on close!");
|
|
295
309
|
this.reconnect();
|
|
296
310
|
}
|
|
297
311
|
},
|
|
298
312
|
this.reconnectInternal,
|
|
299
|
-
this
|
|
313
|
+
this
|
|
300
314
|
);
|
|
301
315
|
}
|
|
302
316
|
|
package/types/FW.d.ts
CHANGED
|
@@ -8,18 +8,13 @@ declare namespace FW {
|
|
|
8
8
|
prototype: T;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
type ServiceIdentifierData<TInstance = unknown> =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type
|
|
18
|
-
TInstance = unknown,
|
|
19
|
-
TArgs extends unknown[] = any[]
|
|
20
|
-
> = Newable<TInstance, TArgs>;
|
|
21
|
-
type CommonServiceIdentifier<TInstance = unknown> =
|
|
22
|
-
ServiceIdentifierData<TInstance>;
|
|
11
|
+
type ServiceIdentifierData<TInstance = unknown> = string | symbol | Newable<TInstance> | Function;
|
|
12
|
+
|
|
13
|
+
type CommonNewable<TInstance = unknown, TArgs extends unknown[] = any[]> = Newable<
|
|
14
|
+
TInstance,
|
|
15
|
+
TArgs
|
|
16
|
+
>;
|
|
17
|
+
type CommonServiceIdentifier<TInstance = unknown> = ServiceIdentifierData<TInstance>;
|
|
23
18
|
|
|
24
19
|
type ServiceIdentifier<T = unknown> = CommonServiceIdentifier<T>;
|
|
25
20
|
/**
|
|
@@ -65,13 +60,13 @@ declare namespace FW {
|
|
|
65
60
|
resolve: (value: T | PromiseLike<T>) => void,
|
|
66
61
|
reject: (reason?: any) => void,
|
|
67
62
|
signal?: AbortSignal,
|
|
68
|
-
reason?: any
|
|
63
|
+
reason?: any,
|
|
69
64
|
) => void = PromiseExcutor,
|
|
70
|
-
options: PromiseExecuteOptions = {}
|
|
65
|
+
options: PromiseExecuteOptions = {},
|
|
71
66
|
): PromiseProxy<T>;
|
|
72
67
|
all<T = any>(
|
|
73
68
|
promises: FW.PromiseProxy<T>[],
|
|
74
|
-
options: FW.PromiseExecuteOptions = {}
|
|
69
|
+
options: FW.PromiseExecuteOptions = {},
|
|
75
70
|
): FW.PromiseProxy<FW.PromiseResult<T>>;
|
|
76
71
|
};
|
|
77
72
|
|
|
@@ -79,22 +74,18 @@ declare namespace FW {
|
|
|
79
74
|
registerLanguagePackageEnum(
|
|
80
75
|
bundleName: string,
|
|
81
76
|
language: any,
|
|
82
|
-
getter: (key: string, language?: string) => string
|
|
77
|
+
getter: (key: string, language?: string) => string,
|
|
83
78
|
): void;
|
|
84
79
|
getSupportedLanguages(): string[];
|
|
85
80
|
setSupportedLanguages(languages: string[]): void;
|
|
86
81
|
getBundles(): string[];
|
|
87
82
|
getLanguage(): string;
|
|
88
83
|
getLanguageIndex(): number;
|
|
89
|
-
getLanguagePackageValue(
|
|
90
|
-
bundleName: string,
|
|
91
|
-
key: string,
|
|
92
|
-
language?: string
|
|
93
|
-
): string;
|
|
84
|
+
getLanguagePackageValue(bundleName: string, key: string, language?: string): string;
|
|
94
85
|
getLanguagePackageEnumKeys(bundleName: string): string[];
|
|
95
86
|
getLanguagePackageEnumValues(bundleName: string): string[];
|
|
96
87
|
getLanguagePackageEnum<K extends keyof ILanguageBundleAccessor>(
|
|
97
|
-
bundleName: K
|
|
88
|
+
bundleName: K,
|
|
98
89
|
): ILanguageBundleAccessor[K];
|
|
99
90
|
initializeLanguage(language: string);
|
|
100
91
|
};
|
|
@@ -112,32 +103,32 @@ declare namespace FW {
|
|
|
112
103
|
createObjectPool<T extends FWObject = FWObject>(
|
|
113
104
|
node: cc.Node,
|
|
114
105
|
parent: cc.Node,
|
|
115
|
-
tag?: string
|
|
106
|
+
tag?: string,
|
|
116
107
|
): Promise<ObjectPool<T>>;
|
|
117
108
|
createObjectPool<T extends FWObject = FWObject>(
|
|
118
109
|
prefab: cc.Prefab,
|
|
119
110
|
parent: cc.Node,
|
|
120
|
-
tag?: string
|
|
111
|
+
tag?: string,
|
|
121
112
|
): Promise<ObjectPool<T>>;
|
|
122
113
|
createObjectPool<T extends FWObject = FWObject>(
|
|
123
114
|
assetProperty: FW.AssetProperty,
|
|
124
115
|
parent: cc.Node,
|
|
125
|
-
tag?: string
|
|
116
|
+
tag?: string,
|
|
126
117
|
): Promise<ObjectPool<T>>;
|
|
127
118
|
createObjectPool<T extends FWObject = FWObject>(
|
|
128
119
|
node: cc.Node,
|
|
129
120
|
parent: cc.Node,
|
|
130
|
-
type?: number
|
|
121
|
+
type?: number,
|
|
131
122
|
): Promise<ObjectPool<T>>;
|
|
132
123
|
createObjectPool<T extends FWObject = FWObject>(
|
|
133
124
|
prefab: cc.Prefab,
|
|
134
125
|
parent: cc.Node,
|
|
135
|
-
type?: number
|
|
126
|
+
type?: number,
|
|
136
127
|
): Promise<ObjectPool<T>>;
|
|
137
128
|
createObjectPool<T extends FWObject = FWObject>(
|
|
138
129
|
assetProperty: FW.AssetProperty,
|
|
139
130
|
parent: cc.Node,
|
|
140
|
-
type?: number
|
|
131
|
+
type?: number,
|
|
141
132
|
): Promise<ObjectPool<T>>;
|
|
142
133
|
/** 获取已经创建的对象池 */
|
|
143
134
|
getObjectPool(tag: string): ObjectPool;
|
|
@@ -170,7 +161,7 @@ declare namespace FW {
|
|
|
170
161
|
address: string,
|
|
171
162
|
sender: Sender,
|
|
172
163
|
handle: Handle,
|
|
173
|
-
config: SocketConfig
|
|
164
|
+
config: SocketConfig,
|
|
174
165
|
): Promise<Socket>;
|
|
175
166
|
/**
|
|
176
167
|
* 获取socket
|
|
@@ -266,7 +257,7 @@ declare namespace FW {
|
|
|
266
257
|
tag: string,
|
|
267
258
|
sender: Sender,
|
|
268
259
|
handle: SocketHandle,
|
|
269
|
-
config: SocketConfig
|
|
260
|
+
config: SocketConfig,
|
|
270
261
|
): SocketPromiseProxy;
|
|
271
262
|
};
|
|
272
263
|
|
|
@@ -301,7 +292,7 @@ declare namespace FW {
|
|
|
301
292
|
args7?: FW.EventManagerArgs,
|
|
302
293
|
args8?: FW.EventManagerArgs,
|
|
303
294
|
args9?: FW.EventManagerArgs,
|
|
304
|
-
args10?: FW.EventManagerArgs
|
|
295
|
+
args10?: FW.EventManagerArgs,
|
|
305
296
|
);
|
|
306
297
|
/**
|
|
307
298
|
* 比较目标
|
|
@@ -362,35 +353,19 @@ declare namespace FW {
|
|
|
362
353
|
/**
|
|
363
354
|
* 一次性调度器
|
|
364
355
|
*/
|
|
365
|
-
scheduleOnce(
|
|
366
|
-
cb?: () => void,
|
|
367
|
-
time?: number,
|
|
368
|
-
tag?: string
|
|
369
|
-
): FW.TimerSchedule;
|
|
356
|
+
scheduleOnce(cb?: () => void, time?: number, tag?: string): FW.TimerSchedule;
|
|
370
357
|
/**
|
|
371
358
|
* 一次性调度器
|
|
372
359
|
*/
|
|
373
|
-
scheduleOnce(
|
|
374
|
-
time?: number,
|
|
375
|
-
cb?: () => void,
|
|
376
|
-
tag?: string
|
|
377
|
-
): FW.TimerSchedule;
|
|
360
|
+
scheduleOnce(time?: number, cb?: () => void, tag?: string): FW.TimerSchedule;
|
|
378
361
|
/**
|
|
379
362
|
* 一次性调度器
|
|
380
363
|
*/
|
|
381
|
-
scheduleOnce(
|
|
382
|
-
time?: number,
|
|
383
|
-
cb?: () => void,
|
|
384
|
-
target?: any
|
|
385
|
-
): FW.TimerSchedule;
|
|
364
|
+
scheduleOnce(time?: number, cb?: () => void, target?: any): FW.TimerSchedule;
|
|
386
365
|
/**
|
|
387
366
|
* 一次性调度器
|
|
388
367
|
*/
|
|
389
|
-
scheduleOnce(
|
|
390
|
-
cb?: () => void,
|
|
391
|
-
time?: number,
|
|
392
|
-
target?: any
|
|
393
|
-
): FW.TimerSchedule;
|
|
368
|
+
scheduleOnce(cb?: () => void, time?: number, target?: any): FW.TimerSchedule;
|
|
394
369
|
/**
|
|
395
370
|
* 自定义调度器
|
|
396
371
|
* */
|
|
@@ -399,7 +374,7 @@ declare namespace FW {
|
|
|
399
374
|
time?: number,
|
|
400
375
|
repeat?: number,
|
|
401
376
|
target?: TargetType,
|
|
402
|
-
tag?: string
|
|
377
|
+
tag?: string,
|
|
403
378
|
): TimerSchedule;
|
|
404
379
|
/** 暂停调度器 */
|
|
405
380
|
pauseSchedule(tag: string): void;
|
|
@@ -450,13 +425,13 @@ declare namespace FW {
|
|
|
450
425
|
args7?: EventManagerArgs,
|
|
451
426
|
args8?: EventManagerArgs,
|
|
452
427
|
args9?: EventManagerArgs,
|
|
453
|
-
args10?: EventManagerArgs
|
|
428
|
+
args10?: EventManagerArgs,
|
|
454
429
|
) => void,
|
|
455
430
|
target: TargetType,
|
|
456
431
|
options?: {
|
|
457
432
|
priority?: FW.SystemDefine.FWPriorityOrder;
|
|
458
433
|
intercept?: boolean;
|
|
459
|
-
}
|
|
434
|
+
},
|
|
460
435
|
);
|
|
461
436
|
|
|
462
437
|
registerOnce(
|
|
@@ -471,13 +446,13 @@ declare namespace FW {
|
|
|
471
446
|
args7?: EventManagerArgs,
|
|
472
447
|
args8?: EventManagerArgs,
|
|
473
448
|
args9?: EventManagerArgs,
|
|
474
|
-
args10?: EventManagerArgs
|
|
449
|
+
args10?: EventManagerArgs,
|
|
475
450
|
) => void,
|
|
476
451
|
target: TargetType,
|
|
477
452
|
options?: {
|
|
478
453
|
priority?: number;
|
|
479
454
|
intercept?: boolean;
|
|
480
|
-
}
|
|
455
|
+
},
|
|
481
456
|
): void;
|
|
482
457
|
|
|
483
458
|
/**
|
|
@@ -511,7 +486,7 @@ declare namespace FW {
|
|
|
511
486
|
args7?: FW.EventManagerArgs,
|
|
512
487
|
args8?: FW.EventManagerArgs,
|
|
513
488
|
args9?: FW.EventManagerArgs,
|
|
514
|
-
args10?: FW.EventManagerArgs
|
|
489
|
+
args10?: FW.EventManagerArgs,
|
|
515
490
|
): void;
|
|
516
491
|
/**
|
|
517
492
|
* 注销事件
|
|
@@ -657,37 +632,29 @@ declare namespace FW {
|
|
|
657
632
|
* @param data
|
|
658
633
|
*/
|
|
659
634
|
openAsync<Ctr extends FW.LayerController = FWLayerController>(
|
|
660
|
-
data: LayerOpenArgs<Ctr
|
|
635
|
+
data: LayerOpenArgs<Ctr>,
|
|
661
636
|
): Promise<Ctr>;
|
|
662
637
|
|
|
663
638
|
/**
|
|
664
639
|
* 同步打开layer
|
|
665
640
|
* @param data
|
|
666
641
|
*/
|
|
667
|
-
openSync<Ctr extends FW.LayerController = FWLayerController>(
|
|
668
|
-
data: LayerOpenArgs<Ctr>
|
|
669
|
-
): Ctr;
|
|
642
|
+
openSync<Ctr extends FW.LayerController = FWLayerController>(data: LayerOpenArgs<Ctr>): Ctr;
|
|
670
643
|
/**
|
|
671
644
|
* 显示常驻layer
|
|
672
645
|
* @param layer
|
|
673
646
|
*/
|
|
674
|
-
displayLayer<Ctr extends FW.LayerController = FWLayerController>(
|
|
675
|
-
ctr: Ctr
|
|
676
|
-
): Ctr;
|
|
647
|
+
displayLayer<Ctr extends FW.LayerController = FWLayerController>(ctr: Ctr): Ctr;
|
|
677
648
|
/**
|
|
678
649
|
* 隐藏常驻layer
|
|
679
650
|
* @param layer
|
|
680
651
|
*/
|
|
681
|
-
hideLayer<Ctr extends FW.LayerController = FWLayerController>(
|
|
682
|
-
ctr: Ctr
|
|
683
|
-
): Ctr;
|
|
652
|
+
hideLayer<Ctr extends FW.LayerController = FWLayerController>(ctr: Ctr): Ctr;
|
|
684
653
|
/**
|
|
685
654
|
* 关闭layer
|
|
686
655
|
* @param layer
|
|
687
656
|
*/
|
|
688
|
-
close<Ctr extends FW.LayerController = FWLayerController>(
|
|
689
|
-
ctr: Ctr
|
|
690
|
-
): FWLayerController;
|
|
657
|
+
close<Ctr extends FW.LayerController = FWLayerController>(ctr: Ctr): FWLayerController;
|
|
691
658
|
|
|
692
659
|
/**
|
|
693
660
|
* 从栈关闭
|
|
@@ -793,10 +760,7 @@ declare namespace FW {
|
|
|
793
760
|
* @param url
|
|
794
761
|
* @param cb
|
|
795
762
|
*/
|
|
796
|
-
loadRemote<T extends cc.Asset = cc.Asset>(
|
|
797
|
-
url: string,
|
|
798
|
-
cb?: (asset: cc.Asset) => T
|
|
799
|
-
): Promise<T>;
|
|
763
|
+
loadRemote<T extends cc.Asset = cc.Asset>(url: string, cb?: (asset: cc.Asset) => T): Promise<T>;
|
|
800
764
|
/**
|
|
801
765
|
* 从远程加载spine动画
|
|
802
766
|
* @param data
|
|
@@ -812,18 +776,13 @@ declare namespace FW {
|
|
|
812
776
|
* 加载资源返回数据
|
|
813
777
|
* @param assetProperty
|
|
814
778
|
*/
|
|
815
|
-
loadAssetData<T extends cc.Asset>(
|
|
816
|
-
assetProperty: AssetProperty
|
|
817
|
-
): Promise<AssetData>;
|
|
779
|
+
loadAssetData<T extends cc.Asset>(assetProperty: AssetProperty): Promise<AssetData>;
|
|
818
780
|
|
|
819
781
|
/**
|
|
820
782
|
* 加载资源
|
|
821
783
|
* @param assetProperty
|
|
822
784
|
*/
|
|
823
|
-
loadAsset<T extends cc.Asset>(
|
|
824
|
-
assetProperty: AssetProperty,
|
|
825
|
-
cb?: () => void
|
|
826
|
-
): Promise<T>;
|
|
785
|
+
loadAsset<T extends cc.Asset>(assetProperty: AssetProperty, cb?: () => void): Promise<T>;
|
|
827
786
|
|
|
828
787
|
/**
|
|
829
788
|
* 获取资源
|
|
@@ -971,10 +930,7 @@ declare namespace FW {
|
|
|
971
930
|
* @param url
|
|
972
931
|
* @param cb
|
|
973
932
|
*/
|
|
974
|
-
loadRemote<T extends cc.Asset = cc.Asset>(
|
|
975
|
-
url: string,
|
|
976
|
-
cb?: (asset: cc.Asset) => T
|
|
977
|
-
): Promise<T>;
|
|
933
|
+
loadRemote<T extends cc.Asset = cc.Asset>(url: string, cb?: (asset: cc.Asset) => T): Promise<T>;
|
|
978
934
|
/**
|
|
979
935
|
* 从远程加载spine动画
|
|
980
936
|
* @param data
|
|
@@ -1019,7 +975,6 @@ declare namespace FW {
|
|
|
1019
975
|
};
|
|
1020
976
|
|
|
1021
977
|
type EngineManager = {
|
|
1022
|
-
launchScene: string;
|
|
1023
978
|
debug: boolean;
|
|
1024
979
|
getMemory(): void;
|
|
1025
980
|
restart(): void;
|
|
@@ -1178,7 +1133,7 @@ declare namespace FW {
|
|
|
1178
1133
|
*/
|
|
1179
1134
|
register(
|
|
1180
1135
|
state: FW.StateMachineRegisterArgs | FW.StateMachineRegisterArgs[],
|
|
1181
|
-
stateMachineName?: string
|
|
1136
|
+
stateMachineName?: string,
|
|
1182
1137
|
);
|
|
1183
1138
|
/**
|
|
1184
1139
|
* 注销指定状态机的某个状态
|
|
@@ -1234,22 +1189,22 @@ declare namespace FW {
|
|
|
1234
1189
|
progress: Function;
|
|
1235
1190
|
easing: Function | String;
|
|
1236
1191
|
onUpdate: Function;
|
|
1237
|
-
}
|
|
1192
|
+
}>,
|
|
1238
1193
|
>(
|
|
1239
1194
|
duration: number,
|
|
1240
1195
|
props: ConstructorType<T>,
|
|
1241
|
-
opts?: OPTS
|
|
1196
|
+
opts?: OPTS,
|
|
1242
1197
|
): FW.Tween;
|
|
1243
1198
|
by<
|
|
1244
1199
|
OPTS extends Partial<{
|
|
1245
1200
|
progress: Function;
|
|
1246
1201
|
easing: Function | String;
|
|
1247
1202
|
onUpdate: Function;
|
|
1248
|
-
}
|
|
1203
|
+
}>,
|
|
1249
1204
|
>(
|
|
1250
1205
|
duration: number,
|
|
1251
1206
|
props: ConstructorType<T>,
|
|
1252
|
-
opts?: OPTS
|
|
1207
|
+
opts?: OPTS,
|
|
1253
1208
|
): FW.Tween;
|
|
1254
1209
|
set(props: ConstructorType<T>): FW.Tween;
|
|
1255
1210
|
};
|
|
@@ -1489,11 +1444,7 @@ declare namespace FW {
|
|
|
1489
1444
|
* @param volume
|
|
1490
1445
|
* @param loop
|
|
1491
1446
|
*/
|
|
1492
|
-
playMusic(
|
|
1493
|
-
assetProperty: AssetProperty,
|
|
1494
|
-
volume?: number,
|
|
1495
|
-
loop?: boolean
|
|
1496
|
-
): void;
|
|
1447
|
+
playMusic(assetProperty: AssetProperty, volume?: number, loop?: boolean): void;
|
|
1497
1448
|
/**
|
|
1498
1449
|
* 停止背景音乐
|
|
1499
1450
|
*/
|
|
@@ -1522,12 +1473,7 @@ declare namespace FW {
|
|
|
1522
1473
|
* @param volume
|
|
1523
1474
|
* @param loop
|
|
1524
1475
|
*/
|
|
1525
|
-
play(
|
|
1526
|
-
path: string,
|
|
1527
|
-
cb?: (id: number) => void,
|
|
1528
|
-
volume?: number,
|
|
1529
|
-
loop?: boolean
|
|
1530
|
-
);
|
|
1476
|
+
play(path: string, cb?: (id: number) => void, volume?: number, loop?: boolean): Promise<number>;
|
|
1531
1477
|
/**
|
|
1532
1478
|
* 播放音效
|
|
1533
1479
|
* @param audio
|
|
@@ -1538,8 +1484,8 @@ declare namespace FW {
|
|
|
1538
1484
|
audio: cc.AudioClip,
|
|
1539
1485
|
cb?: (id: number) => void,
|
|
1540
1486
|
volume?: number,
|
|
1541
|
-
loop?: boolean
|
|
1542
|
-
)
|
|
1487
|
+
loop?: boolean,
|
|
1488
|
+
): Promise<number>;
|
|
1543
1489
|
/**
|
|
1544
1490
|
* 播放音效
|
|
1545
1491
|
* @param assetProperty
|
|
@@ -1550,8 +1496,8 @@ declare namespace FW {
|
|
|
1550
1496
|
assetProperty: AssetProperty,
|
|
1551
1497
|
cb?: (id: number) => void,
|
|
1552
1498
|
volume?: number,
|
|
1553
|
-
loop?: boolean
|
|
1554
|
-
)
|
|
1499
|
+
loop?: boolean,
|
|
1500
|
+
): Promise<number>;
|
|
1555
1501
|
/**
|
|
1556
1502
|
* 暂停所有
|
|
1557
1503
|
*/
|
|
@@ -1572,11 +1518,7 @@ declare namespace FW {
|
|
|
1572
1518
|
};
|
|
1573
1519
|
|
|
1574
1520
|
type PerformanceManager = {
|
|
1575
|
-
recordOperationMetric(
|
|
1576
|
-
manager: string,
|
|
1577
|
-
operation: string,
|
|
1578
|
-
duration: number
|
|
1579
|
-
): void;
|
|
1521
|
+
recordOperationMetric(manager: string, operation: string, duration: number): void;
|
|
1580
1522
|
getModuleReport(manager: string): PerformanceReport;
|
|
1581
1523
|
getAllReports(): Map<string, FW.PerformanceReport>;
|
|
1582
1524
|
};
|
|
@@ -1875,7 +1817,7 @@ declare namespace FW {
|
|
|
1875
1817
|
abort?: (reason?: any) => void;
|
|
1876
1818
|
addAbortEventListener?: (
|
|
1877
1819
|
listener: (this: AbortSignal, ev: Event) => any,
|
|
1878
|
-
options?: boolean | AddEventListenerOptions
|
|
1820
|
+
options?: boolean | AddEventListenerOptions,
|
|
1879
1821
|
) => void;
|
|
1880
1822
|
};
|
|
1881
1823
|
|
|
@@ -1883,7 +1825,7 @@ declare namespace FW {
|
|
|
1883
1825
|
resolve: (value: T | PromiseLike<T>) => void,
|
|
1884
1826
|
reject: (reason?: any) => void,
|
|
1885
1827
|
signal: AbortSignal,
|
|
1886
|
-
reason?: any
|
|
1828
|
+
reason?: any,
|
|
1887
1829
|
) => void;
|
|
1888
1830
|
|
|
1889
1831
|
type PromiseExecuteOptions = {
|
|
@@ -1894,10 +1836,7 @@ declare namespace FW {
|
|
|
1894
1836
|
retryCondition?: (error: any, retryCount: number) => boolean;
|
|
1895
1837
|
};
|
|
1896
1838
|
|
|
1897
|
-
type Promise = (
|
|
1898
|
-
resolve: (value: any) => void,
|
|
1899
|
-
reject: (reason?: any) => void
|
|
1900
|
-
) => void;
|
|
1839
|
+
type Promise = (resolve: (value: any) => void, reject: (reason?: any) => void) => void;
|
|
1901
1840
|
|
|
1902
1841
|
type PromiseResult<T = any> = {
|
|
1903
1842
|
success: PromiseProxy<T>[];
|
|
@@ -1905,7 +1844,7 @@ declare namespace FW {
|
|
|
1905
1844
|
cancelled: number[];
|
|
1906
1845
|
};
|
|
1907
1846
|
|
|
1908
|
-
type PromiseStatus =
|
|
1847
|
+
type PromiseStatus = 'pending' | 'fulfilled' | 'rejected' | 'cancelled';
|
|
1909
1848
|
|
|
1910
1849
|
/**
|
|
1911
1850
|
* 性能管理器配置
|
|
@@ -1953,7 +1892,7 @@ declare namespace FW {
|
|
|
1953
1892
|
type PropertyDecorator = (
|
|
1954
1893
|
$class: Record<string, any>,
|
|
1955
1894
|
$propertyKey: string | symbol,
|
|
1956
|
-
$descriptorOrInitializer?: any
|
|
1895
|
+
$descriptorOrInitializer?: any,
|
|
1957
1896
|
) => void;
|
|
1958
1897
|
|
|
1959
1898
|
declare function timeScale(scale: number);
|
|
@@ -2001,10 +1940,7 @@ declare namespace FW {
|
|
|
2001
1940
|
public config?: FW.AssetConfig;
|
|
2002
1941
|
public sender?: FW.Sender;
|
|
2003
1942
|
public handle?: FW.Handle;
|
|
2004
|
-
public invoke<T>(
|
|
2005
|
-
operation: Promise<T>,
|
|
2006
|
-
operationName: string = "unknown"
|
|
2007
|
-
): Promise<T>;
|
|
1943
|
+
public invoke<T>(operation: Promise<T>, operationName: string = 'unknown'): Promise<T>;
|
|
2008
1944
|
public getLogic<T extends FW.Logic = FWLogic>();
|
|
2009
1945
|
public getData<T extends FW.Data = FWData>();
|
|
2010
1946
|
public getSender<T extends FW.Sender>();
|
|
@@ -2062,10 +1998,10 @@ declare namespace FW {
|
|
|
2062
1998
|
}
|
|
2063
1999
|
|
|
2064
2000
|
export class FWTaskStatus {
|
|
2065
|
-
static IDLE =
|
|
2066
|
-
static RUNNING =
|
|
2067
|
-
static PAUSED =
|
|
2068
|
-
static COMPLETED =
|
|
2001
|
+
static IDLE = 'IDLE';
|
|
2002
|
+
static RUNNING = 'RUNNING';
|
|
2003
|
+
static PAUSED = 'PAUSED';
|
|
2004
|
+
static COMPLETED = 'COMPLETED';
|
|
2069
2005
|
}
|
|
2070
2006
|
|
|
2071
2007
|
export class FWPriorityOrder {
|
|
@@ -2109,17 +2045,17 @@ declare namespace FW {
|
|
|
2109
2045
|
* HTTP请求类型
|
|
2110
2046
|
*/
|
|
2111
2047
|
export class FWHttpRequestType {
|
|
2112
|
-
static GET =
|
|
2113
|
-
static POST =
|
|
2048
|
+
static GET = 'GET';
|
|
2049
|
+
static POST = 'POST';
|
|
2114
2050
|
}
|
|
2115
2051
|
|
|
2116
2052
|
/**
|
|
2117
2053
|
* 动画机类型
|
|
2118
2054
|
*/
|
|
2119
2055
|
export class FWAnimationMachineType {
|
|
2120
|
-
static TWEEN =
|
|
2121
|
-
static SKELETON =
|
|
2122
|
-
static ANIMATION =
|
|
2056
|
+
static TWEEN = 'TWEEN';
|
|
2057
|
+
static SKELETON = 'SKELETON';
|
|
2058
|
+
static ANIMATION = 'ANIMATION';
|
|
2123
2059
|
}
|
|
2124
2060
|
|
|
2125
2061
|
export class FWScrollViewTemplateType {
|
|
@@ -2140,23 +2076,23 @@ declare namespace FW {
|
|
|
2140
2076
|
}
|
|
2141
2077
|
|
|
2142
2078
|
export class FWLanguageAssetType {
|
|
2143
|
-
static LABEL =
|
|
2144
|
-
static SPRITE =
|
|
2145
|
-
static SKELETON =
|
|
2079
|
+
static LABEL = 'label';
|
|
2080
|
+
static SPRITE = 'sprite';
|
|
2081
|
+
static SKELETON = 'skeleton';
|
|
2146
2082
|
}
|
|
2147
2083
|
|
|
2148
2084
|
export class FWPromiseStatus {
|
|
2149
|
-
static PENDING =
|
|
2150
|
-
static FULFILLED =
|
|
2151
|
-
static REJECTED =
|
|
2152
|
-
static CANCELLED =
|
|
2085
|
+
static PENDING = 'pending';
|
|
2086
|
+
static FULFILLED = 'fulfilled';
|
|
2087
|
+
static REJECTED = 'rejected';
|
|
2088
|
+
static CANCELLED = 'cancelled';
|
|
2153
2089
|
}
|
|
2154
2090
|
|
|
2155
2091
|
export class FWLayerState {
|
|
2156
|
-
static CLOSED =
|
|
2157
|
-
static OPENING =
|
|
2158
|
-
static OPENED =
|
|
2159
|
-
static CLOSING =
|
|
2092
|
+
static CLOSED = 'closed';
|
|
2093
|
+
static OPENING = 'opening';
|
|
2094
|
+
static OPENED = 'opened';
|
|
2095
|
+
static CLOSING = 'closing';
|
|
2160
2096
|
}
|
|
2161
2097
|
|
|
2162
2098
|
export class FWAudioType {
|
|
@@ -2167,21 +2103,21 @@ declare namespace FW {
|
|
|
2167
2103
|
namespace EventDefine {
|
|
2168
2104
|
export class LanguageEvent {
|
|
2169
2105
|
/** 语言变更 */
|
|
2170
|
-
static LANGUAGE_CHANGE =
|
|
2106
|
+
static LANGUAGE_CHANGE = 'LANGUAGE_CHANGE';
|
|
2171
2107
|
}
|
|
2172
2108
|
|
|
2173
2109
|
export class TaskEvent {
|
|
2174
|
-
static START =
|
|
2175
|
-
static PROGRESS =
|
|
2176
|
-
static COMPLETE =
|
|
2177
|
-
static YIELDED =
|
|
2178
|
-
static PAUSE =
|
|
2179
|
-
static RESUME =
|
|
2180
|
-
static FRAME_START =
|
|
2181
|
-
static FRAME_END =
|
|
2182
|
-
static QUEUE =
|
|
2183
|
-
static ALL_COMPLETE =
|
|
2184
|
-
static ERROR =
|
|
2110
|
+
static START = 'START';
|
|
2111
|
+
static PROGRESS = 'PROGRESS';
|
|
2112
|
+
static COMPLETE = 'COMPLETE';
|
|
2113
|
+
static YIELDED = 'YIELDED';
|
|
2114
|
+
static PAUSE = 'PAUSE';
|
|
2115
|
+
static RESUME = 'RESUME';
|
|
2116
|
+
static FRAME_START = 'FRAME_START';
|
|
2117
|
+
static FRAME_END = 'FRAME_END';
|
|
2118
|
+
static QUEUE = 'QUEUE';
|
|
2119
|
+
static ALL_COMPLETE = 'ALL_COMPLETE';
|
|
2120
|
+
static ERROR = 'ERROR';
|
|
2185
2121
|
}
|
|
2186
2122
|
|
|
2187
2123
|
export class SystemEvent {
|
|
@@ -2189,8 +2125,8 @@ declare namespace FW {
|
|
|
2189
2125
|
}
|
|
2190
2126
|
|
|
2191
2127
|
export class CCEvent {
|
|
2192
|
-
static ON_SHOW =
|
|
2193
|
-
static ON_HIDE =
|
|
2128
|
+
static ON_SHOW = 'ON_SHOW';
|
|
2129
|
+
static ON_HIDE = 'ON_HIDE';
|
|
2194
2130
|
}
|
|
2195
2131
|
}
|
|
2196
2132
|
export const SystemDefine: SystemDefine;
|
|
@@ -2244,19 +2180,6 @@ declare namespace FW {
|
|
|
2244
2180
|
onDisable?();
|
|
2245
2181
|
onDestroy?();
|
|
2246
2182
|
onClose?();
|
|
2247
|
-
cc(
|
|
2248
|
-
target: cc.Node,
|
|
2249
|
-
cb: (event: cc.Event) => void,
|
|
2250
|
-
responseInterval?: number,
|
|
2251
|
-
eventName?: string
|
|
2252
|
-
): this;
|
|
2253
|
-
|
|
2254
|
-
fw(
|
|
2255
|
-
eventName: string,
|
|
2256
|
-
cb: (event: cc.Event) => void,
|
|
2257
|
-
target?: cc.Node,
|
|
2258
|
-
responseInterval?: number
|
|
2259
|
-
): this;
|
|
2260
2183
|
|
|
2261
2184
|
/**
|
|
2262
2185
|
* 查找节点
|
|
@@ -2277,7 +2200,7 @@ declare namespace FW {
|
|
|
2277
2200
|
referenceNode: cc.Node,
|
|
2278
2201
|
type?: {
|
|
2279
2202
|
prototype: T;
|
|
2280
|
-
}
|
|
2203
|
+
},
|
|
2281
2204
|
): T;
|
|
2282
2205
|
registerEvent(args: RegisterArgs): void;
|
|
2283
2206
|
unRegisterEvent(args: RegisterArgs);
|