@ives_xxz/framework 2.0.0 → 2.0.1
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/FrameworkBase.ts +11 -13
- package/package.json +1 -1
- package/types/FW.d.ts +2 -2
package/FrameworkBase.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { injectable } from 'inversify';
|
|
2
|
-
import FWLogic from './logic/FWLogic';
|
|
3
|
-
import FWData from './data/FWData';
|
|
4
2
|
|
|
5
3
|
@injectable()
|
|
6
4
|
export abstract class FrameworkBase {
|
|
7
5
|
public logic?: FW.Logic;
|
|
8
6
|
public data?: FW.Data;
|
|
9
|
-
public config?: FW.
|
|
10
|
-
public sender?: FW.
|
|
11
|
-
public handle?: FW.
|
|
7
|
+
public config?: FW.AssetConfig;
|
|
8
|
+
public sender?: FW.Sender;
|
|
9
|
+
public handle?: FW.Handle;
|
|
12
10
|
private dependenciesInjected: boolean = false;
|
|
13
11
|
private isInitialized: boolean = false;
|
|
14
12
|
protected abstract initialize?(): void;
|
|
@@ -27,23 +25,23 @@ export abstract class FrameworkBase {
|
|
|
27
25
|
return this.constructor.name;
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
public getLogic<T extends FW.Logic =
|
|
28
|
+
public getLogic<T extends FW.Logic = FW.Logic>() {
|
|
31
29
|
return this.logic as T;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
public getData<T extends FW.Data =
|
|
32
|
+
public getData<T extends FW.Data = FW.Data>() {
|
|
35
33
|
return this.data as T;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
public getSender<T extends FW.
|
|
36
|
+
public getSender<T extends FW.Sender>() {
|
|
39
37
|
return this.sender as T;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
public getHandle<T extends FW.
|
|
40
|
+
public getHandle<T extends FW.Handle>() {
|
|
43
41
|
return this.handle as T;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
|
-
public getConfig<T extends FW.
|
|
44
|
+
public getConfig<T extends FW.AssetConfig>() {
|
|
47
45
|
return this.config as T;
|
|
48
46
|
}
|
|
49
47
|
|
|
@@ -71,19 +69,19 @@ export abstract class FrameworkBase {
|
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
if (tag !== FW.SystemDefine.FWBindTag.CONFIG) {
|
|
74
|
-
this.config = FW.Framework.getComponent<FW.
|
|
72
|
+
this.config = FW.Framework.getComponent<FW.AssetConfig>(
|
|
75
73
|
`${bundleName}${FW.SystemDefine.FWBindTag.CONFIG}`,
|
|
76
74
|
);
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
if (tag !== FW.SystemDefine.FWBindTag.SENDER) {
|
|
80
|
-
this.sender = FW.Framework.getComponent<FW.
|
|
78
|
+
this.sender = FW.Framework.getComponent<FW.Sender>(
|
|
81
79
|
`${bundleName}${FW.SystemDefine.FWBindTag.SENDER}`,
|
|
82
80
|
);
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
if (tag !== FW.SystemDefine.FWBindTag.HANDLE) {
|
|
86
|
-
this.handle = FW.Framework.getComponent<FW.
|
|
84
|
+
this.handle = FW.Framework.getComponent<FW.Handle>(
|
|
87
85
|
`${bundleName}${FW.SystemDefine.FWBindTag.HANDLE}`,
|
|
88
86
|
);
|
|
89
87
|
}
|
package/package.json
CHANGED
package/types/FW.d.ts
CHANGED
|
@@ -2278,8 +2278,8 @@ declare namespace FW {
|
|
|
2278
2278
|
onDestroy?();
|
|
2279
2279
|
sendHeart();
|
|
2280
2280
|
onHeart?(msg: any): Promise<boolean>;
|
|
2281
|
-
|
|
2282
|
-
|
|
2281
|
+
onBeforeSendingMessage?(msg: any): Promise<FW.SocketMessage>;
|
|
2282
|
+
getProtocolKey?(msg: any): string;
|
|
2283
2283
|
send(msg: any);
|
|
2284
2284
|
}
|
|
2285
2285
|
|