@xmov/avatar 2.4.0-beta.3 → 2.4.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmov/avatar",
3
- "version": "2.4.0-beta.3",
3
+ "version": "2.4.0-beta.4",
4
4
  "description": "魔珐数字人 JS-SDK",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
package/src/index.ts CHANGED
@@ -643,6 +643,9 @@ export default class XmovAvatar {
643
643
  this.pendingInvisibleMode = true;
644
644
  }
645
645
 
646
+ // Session 请求和资源下载期间也需要处理页面刷新。
647
+ window.addEventListener('beforeunload', this.handleBeforeUnload);
648
+
646
649
  // 加载资源(sdk.resource_load:资源包下载/解析耗时)
647
650
  (window as any).performanceTracker.markStart(performanceConstant.load_resource);
648
651
  (window as any).performanceTracker.markStart(performanceConstant.first_avatar_render);
@@ -675,7 +678,6 @@ export default class XmovAvatar {
675
678
  // 设置上报使用ttsa
676
679
  (window as any).performanceTracker.setReportFunc(this.ttsa);
677
680
 
678
- window.addEventListener('beforeunload', this.handleBeforeUnload);
679
681
  document.addEventListener('visibilitychange', this.boundVisibilityChange);
680
682
  initSpan?.end();
681
683
  return sessionInfo;