@netless/window-manager 0.4.39 → 0.4.42

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.
@@ -188,6 +188,7 @@ export class AppProxy implements PageRemoveService {
188
188
  this.setViewFocusScenePath();
189
189
  setTimeout(async () => {
190
190
  // 延迟执行 setup, 防止初始化的属性没有更新成功
191
+ console.log("setup app", app);
191
192
  const result = await app.setup(context);
192
193
  this.appResult = result;
193
194
  appRegister.notifyApp(this.kind, "created", { appId, result });
@@ -39,7 +39,9 @@ export class ContainerResizeObserver {
39
39
  });
40
40
 
41
41
  this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
42
- this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
42
+ const containerRect = container.getBoundingClientRect();
43
+ this.updateSizer(containerRect, sizer, wrapper);
44
+ this.emitter.emit("playgroundSizeChange", containerRect);
43
45
  });
44
46
 
45
47
  this.containerResizeObserver.observe(container);
@@ -32,18 +32,23 @@ class AppRegister {
32
32
  this.registered.set(params.kind, params);
33
33
 
34
34
  const paramSrc = params.src;
35
- let srcOrAppOrFunction: () => Promise<NetlessApp>;
36
35
  let downloadApp: () => Promise<NetlessApp>;
37
36
 
38
37
  if (typeof paramSrc === "string") {
39
- srcOrAppOrFunction = () => loadApp(paramSrc, params.kind, params.name);
38
+ downloadApp = async () => {
39
+ const result = await loadApp(paramSrc, params.kind, params.name) as any;
40
+ if (result.__esModule) {
41
+ return result.default;
42
+ }
43
+ return result;
44
+ };
40
45
  if (this.syncRegisterApp) {
41
46
  this.syncRegisterApp({ kind: params.kind, src: paramSrc, name: params.name });
42
47
  }
43
48
  }
44
49
  if (typeof paramSrc === "function") {
45
50
  downloadApp = async () => {
46
- let appClass = await srcOrAppOrFunction() as any;
51
+ let appClass = await paramSrc() as any;
47
52
  if (appClass) {
48
53
  if (appClass.__esModule) {
49
54
  appClass = appClass.default;
@@ -51,7 +56,7 @@ class AppRegister {
51
56
  return appClass;
52
57
  } else {
53
58
  throw new Error(
54
- `[WindowManager]: load remote script failed, ${srcOrAppOrFunction}`
59
+ `[WindowManager]: load remote script failed, ${paramSrc}`
55
60
  );
56
61
  }
57
62
  };
package/src/index.ts CHANGED
@@ -142,7 +142,7 @@ export type MountParams = {
142
142
 
143
143
  export const reconnectRefresher = new ReconnectRefresher({ emitter });
144
144
 
145
- export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> implements PageController {
145
+ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any> implements PageController {
146
146
  public static kind = "WindowManager";
147
147
  public static displayer: Displayer;
148
148
  public static wrapper?: HTMLElement;
@@ -218,7 +218,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
218
218
  throw new Error();
219
219
  }
220
220
  },
221
- { retries: 10 }
221
+ { retries: 10 } as any,
222
222
  );
223
223
  }
224
224