@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 CHANGED
@@ -214,7 +214,8 @@ declare namespace FW {
214
214
  };
215
215
 
216
216
  type SocketPromiseProxy = {
217
- promise: Function;
217
+ promise: Promise<FW.Socket>;
218
+ resolve: Function;
218
219
  socket: FW.Socket;
219
220
  };
220
221
 
@@ -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
- return;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -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<FWSocket>((resolve) => {
108
- this.promiseProxy.promise = resolve;
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?.promise(this);
211
+ this.promiseProxy?.resolve(this);
210
212
  }
211
213
 
212
214
  private heartHandle() {