@netless/window-manager 1.0.13-beta.0 → 1.0.13-beta.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/dist/index.mjs CHANGED
@@ -7451,7 +7451,8 @@ const _AppProxy = class {
7451
7451
  currentMainViewScenePath = this.manager.mainView.scenePath;
7452
7452
  }
7453
7453
  setTimeout(async () => {
7454
- console.log("setup app", app);
7454
+ var _a3;
7455
+ (_a3 = this.Logger) == null ? void 0 : _a3.info(`[WindowManager]: setup app ${this.kind}, appId: ${appId}`);
7455
7456
  const result = await app.setup(context);
7456
7457
  this.appResult = result;
7457
7458
  appRegister.notifyApp(this.kind, "created", { appId, result });
@@ -7657,7 +7658,7 @@ const _AppProxy = class {
7657
7658
  }
7658
7659
  }
7659
7660
  async destroy(needCloseBox, cleanAttrs, skipUpdate, error) {
7660
- var _a;
7661
+ var _a, _b, _c;
7661
7662
  if (this.status === "destroyed")
7662
7663
  return;
7663
7664
  this.status = "destroyed";
@@ -7665,12 +7666,13 @@ const _AppProxy = class {
7665
7666
  await appRegister.notifyApp(this.kind, "destroy", { appId: this.id });
7666
7667
  await this.appEmitter.emit("destroy", { error });
7667
7668
  } catch (error2) {
7669
+ (_a = this.Logger) == null ? void 0 : _a.error(`[WindowManager]: notifyApp error: ${error2.message}`);
7668
7670
  console.error("[WindowManager]: notifyApp error", error2.message, error2.stack);
7669
7671
  }
7670
7672
  this.appEmitter.clearListeners();
7671
7673
  internalEmitter.emit(`destroy-${this.id}`, { error });
7672
7674
  if (needCloseBox) {
7673
- (_a = this.boxManager) == null ? void 0 : _a.closeBox(this.id, skipUpdate);
7675
+ (_b = this.boxManager) == null ? void 0 : _b.closeBox(this.id, skipUpdate);
7674
7676
  }
7675
7677
  if (cleanAttrs) {
7676
7678
  this.store.cleanAppAttributes(this.id);
@@ -7686,6 +7688,7 @@ const _AppProxy = class {
7686
7688
  this.manager.refresher.remove(this.stateKey);
7687
7689
  this.manager.refresher.remove(`${this.id}-fullPath`);
7688
7690
  this._prevFullPath = void 0;
7691
+ (_c = this.Logger) == null ? void 0 : _c.info(`[WindowManager]: destroy app ${this.kind} appId: ${this.id}`);
7689
7692
  }
7690
7693
  close() {
7691
7694
  return this.destroy(true, true, false);
@@ -8441,6 +8444,8 @@ class AppManager {
8441
8444
  internalEmitter.on("setReadonly", this.onReadonlyChanged);
8442
8445
  this.createRootDirScenesCallback();
8443
8446
  appRegister.setSyncRegisterApp((payload) => {
8447
+ var _a;
8448
+ (_a = this.Logger) == null ? void 0 : _a.info(`[WindowManager] syncRegisterApp ${JSON.stringify(payload)}`);
8444
8449
  this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
8445
8450
  });
8446
8451
  }
@@ -8616,7 +8621,9 @@ class AppManager {
8616
8621
  try {
8617
8622
  const appAttributes = this.attributes[id2];
8618
8623
  if (!appAttributes) {
8619
- (_a = this.Logger) == null ? void 0 : _a.error(`[WindowManager]: appAttributes is undefined, appId: ${id2}`);
8624
+ (_a = this.Logger) == null ? void 0 : _a.error(
8625
+ `[WindowManager]: appAttributes is undefined, appId: ${id2}`
8626
+ );
8620
8627
  throw new Error("appAttributes is undefined");
8621
8628
  }
8622
8629
  this.appCreateQueue.push(async () => {
@@ -8690,7 +8697,9 @@ class AppManager {
8690
8697
  async addApp(params, isDynamicPPT) {
8691
8698
  var _a;
8692
8699
  log("addApp", params);
8693
- (_a = this.windowManger.Logger) == null ? void 0 : _a.info(`[WindowManager]: addApp ${params.kind}, isDynamicPPT: ${isDynamicPPT}`);
8700
+ (_a = this.windowManger.Logger) == null ? void 0 : _a.info(
8701
+ `[WindowManager]: addApp ${params.kind}, isDynamicPPT: ${isDynamicPPT}`
8702
+ );
8694
8703
  const { appId, needFocus } = await this.beforeAddApp(params, isDynamicPPT);
8695
8704
  const appProxy = await this.baseInsertApp(params, appId, true, needFocus);
8696
8705
  this.afterAddApp(appProxy);
@@ -8733,7 +8742,9 @@ class AppManager {
8733
8742
  async baseInsertApp(params, appId, isAddApp, focus) {
8734
8743
  var _a, _b;
8735
8744
  if (this.appProxies.has(appId)) {
8736
- (_a = this.windowManger.Logger) == null ? void 0 : _a.warn(`[WindowManager]: app duplicate exists and cannot be created again, appId: ${appId}`);
8745
+ (_a = this.windowManger.Logger) == null ? void 0 : _a.warn(
8746
+ `[WindowManager]: app duplicate exists and cannot be created again, appId: ${appId}`
8747
+ );
8737
8748
  return;
8738
8749
  }
8739
8750
  const AppProxyClass = getExtendClass$1(AppProxy, WindowManager.extendClass);
@@ -19661,7 +19672,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
19661
19672
  const _WindowManager = class extends InvisiblePlugin {
19662
19673
  constructor(context) {
19663
19674
  super(context);
19664
- this.version = "1.0.13-beta.0";
19675
+ this.version = "1.0.13-beta.1";
19665
19676
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
19666
19677
  this.emitter = callbacks$1;
19667
19678
  this.viewMode = ViewMode.Broadcaster;
@@ -19678,6 +19689,7 @@ const _WindowManager = class extends InvisiblePlugin {
19678
19689
  _WindowManager._resolve(manager);
19679
19690
  }
19680
19691
  static async mount(params, extendClass) {
19692
+ var _a;
19681
19693
  const room = params.room;
19682
19694
  _WindowManager.container = params.container;
19683
19695
  _WindowManager.supportAppliancePlugin = params.supportAppliancePlugin;
@@ -19699,6 +19711,13 @@ const _WindowManager = class extends InvisiblePlugin {
19699
19711
  manager = await this.initManager(room);
19700
19712
  if (manager) {
19701
19713
  manager._roomLogger = room.logger;
19714
+ if (_WindowManager.registered.size > 0) {
19715
+ manager._roomLogger.info(
19716
+ `[WindowManager] registered apps: ${JSON.stringify(
19717
+ Array.from(_WindowManager.registered.keys())
19718
+ )}`
19719
+ );
19720
+ }
19702
19721
  }
19703
19722
  }
19704
19723
  if (_WindowManager.isCreated) {
@@ -19708,7 +19727,13 @@ const _WindowManager = class extends InvisiblePlugin {
19708
19727
  if (this.debug) {
19709
19728
  v({ verbose: true });
19710
19729
  }
19711
- log("Already insert room", manager);
19730
+ if (manager == null ? void 0 : manager._roomLogger) {
19731
+ manager._roomLogger.info(
19732
+ `[WindowManager] Already insert room version: ${manager.version}`
19733
+ );
19734
+ } else {
19735
+ log("Already insert room", manager);
19736
+ }
19712
19737
  if (isRoom(this.displayer)) {
19713
19738
  if (!manager) {
19714
19739
  throw new Error("[WindowManager]: init InvisiblePlugin failed");
@@ -19757,9 +19782,17 @@ const _WindowManager = class extends InvisiblePlugin {
19757
19782
  replaceRoomFunction(room, manager);
19758
19783
  internalEmitter.emit("onCreated");
19759
19784
  _WindowManager.isCreated = true;
19785
+ if (manager._roomLogger && manager.attributes.registered && Object.keys(manager.attributes.registered).length > 0) {
19786
+ manager._roomLogger.info(
19787
+ `[WindowManager] attributes registered apps: ${JSON.stringify(
19788
+ Array.from(Object.keys(manager.attributes.registered))
19789
+ )}`
19790
+ );
19791
+ }
19760
19792
  try {
19761
19793
  await initDb();
19762
19794
  } catch (error) {
19795
+ (_a = manager._roomLogger) == null ? void 0 : _a.warn(`[WindowManager] indexedDB open failed: ${error.message}`);
19763
19796
  console.warn("[WindowManager]: indexedDB open failed");
19764
19797
  console.log(error);
19765
19798
  }