@ives_xxz/framework 1.1.5 → 1.1.7
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 +2 -1
- package/manager/FWHotUpdateManager.ts +15 -1
- package/manager/FWSocketManager.ts +2 -2
- package/package.json +1 -1
- package/service/socket/FWSocket.ts +5 -3
package/FW.d.ts
CHANGED
|
@@ -84,7 +84,11 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
84
84
|
FWLog.debug('checkHotUpdate3', this.assetMgr.getLocalManifest());
|
|
85
85
|
FWLog.debug('checkHotUpdate4', this.assetMgr.getLocalManifest().isLoaded());
|
|
86
86
|
if (!this.assetMgr.getLocalManifest() || !this.assetMgr.getLocalManifest().isLoaded()) {
|
|
87
|
-
|
|
87
|
+
this.assetMgr.loadLocalManifest(this.localManifest.nativeUrl);
|
|
88
|
+
if (!this.assetMgr.getLocalManifest() || !this.assetMgr.getLocalManifest().isLoaded()) {
|
|
89
|
+
FWLog.error('Failed to load local manifest');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
88
92
|
}
|
|
89
93
|
this.assetMgr.setEventCallback(this.checkEventHandle.bind(this));
|
|
90
94
|
this.assetMgr.checkUpdate();
|
|
@@ -181,6 +185,16 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
181
185
|
failed = true;
|
|
182
186
|
break;
|
|
183
187
|
case jsb.EventAssetsManager.UPDATE_FINISHED:
|
|
188
|
+
if (event.getPercent() > 0) {
|
|
189
|
+
downloadedFiles = event.getDownloadedFiles();
|
|
190
|
+
totalFiles = event.getTotalFiles();
|
|
191
|
+
downloadedBytes = event.getDownloadedBytes();
|
|
192
|
+
totalBytes = event.getTotalBytes();
|
|
193
|
+
convertDownloadedBytes = this.convertBytes(downloadedBytes);
|
|
194
|
+
convertTotalBytes = this.convertBytes(totalBytes);
|
|
195
|
+
percent = event.getPercent();
|
|
196
|
+
FWLog.debug('正在更新完成 -> ', '下载文件数量:', downloadedFiles, ',下载文件总数量:', totalFiles, ',已下载大小:', convertDownloadedBytes, ',下载总大小:', convertTotalBytes);
|
|
197
|
+
}
|
|
184
198
|
str = 'UPDATE_FINISHED';
|
|
185
199
|
needRestart = true;
|
|
186
200
|
break;
|
|
@@ -13,7 +13,7 @@ export default class FWSocketManager extends FWManager implements FW.SocketManag
|
|
|
13
13
|
public initialize(): void {
|
|
14
14
|
this.socketMap = new Map<string, FW.Socket>();
|
|
15
15
|
}
|
|
16
|
-
public onDestroy(): void {}
|
|
16
|
+
public onDestroy(): void { }
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* 创建一个socket
|
|
@@ -39,7 +39,7 @@ export default class FWSocketManager extends FWManager implements FW.SocketManag
|
|
|
39
39
|
});
|
|
40
40
|
this.socketMap.set(tag, proxy.socket);
|
|
41
41
|
|
|
42
|
-
await proxy.promise
|
|
42
|
+
await proxy.promise;
|
|
43
43
|
|
|
44
44
|
return proxy.socket;
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -101,12 +101,14 @@ export default class FWSocket implements FW.Socket {
|
|
|
101
101
|
|
|
102
102
|
this.promiseProxy = {
|
|
103
103
|
promise: undefined,
|
|
104
|
+
resolve: undefined,
|
|
104
105
|
socket: this,
|
|
105
106
|
};
|
|
106
107
|
|
|
107
|
-
new Promise<
|
|
108
|
-
this.promiseProxy.
|
|
108
|
+
this.promiseProxy.promise = new Promise<FW.Socket>((resolve) => {
|
|
109
|
+
this.promiseProxy.resolve = resolve;
|
|
109
110
|
});
|
|
111
|
+
|
|
110
112
|
return this.promiseProxy;
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
@@ -206,7 +208,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
206
208
|
this.isReconnect = false;
|
|
207
209
|
this.handle?.onOpen?.();
|
|
208
210
|
this.heartHandle();
|
|
209
|
-
this.promiseProxy?.
|
|
211
|
+
this.promiseProxy?.resolve(this);
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
private heartHandle() {
|