@netless/window-manager 0.3.1 → 0.3.2-canary.0

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": "@netless/window-manager",
3
- "version": "0.3.1",
3
+ "version": "0.3.2-canary.0",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
package/src/AppContext.ts CHANGED
@@ -102,13 +102,8 @@ export class AppContext<TAttrs extends Record<string, any>, AppOptions = any> {
102
102
 
103
103
  public async setScenePath(scenePath: string): Promise<void> {
104
104
  if (!this.appProxy.box) return;
105
- if (this.appProxy.box.focus) {
106
- setScenePath(this.getRoom(), scenePath);
107
- } else {
108
- this.emitter.emit("focus", true);
109
- await wait(50);
110
- setScenePath(this.getRoom(), scenePath);
111
- }
105
+ this.appProxy.setFullPath(scenePath);
106
+ this.manager.viewManager.switchAppToWriter(this.appId);
112
107
  }
113
108
 
114
109
  public mountView(dom: HTMLDivElement): void {
package/src/index.ts CHANGED
@@ -170,7 +170,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
170
170
  public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
171
171
  private static isCreated = false;
172
172
 
173
- public version = "0.3.1";
173
+ public version = "0.3.2-canary.0";
174
174
 
175
175
  public appListeners?: AppListeners;
176
176
 
@@ -2,7 +2,6 @@ import { Base } from "./Base";
2
2
  import { callbacks, WindowManager } from "./index";
3
3
  import { reaction, ViewVisionMode } from "white-web-sdk";
4
4
  import { SET_SCENEPATH_DELAY } from "./constants";
5
- import { TELE_BOX_STATE } from "@netless/telebox-insider";
6
5
  import {
7
6
  notifyMainViewModeChange,
8
7
  setScenePath,
@@ -15,6 +14,7 @@ import type { AppManager } from "./AppManager";
15
14
  export class ViewManager extends Base {
16
15
  private views: Map<string, View> = new Map();
17
16
  private timer?: number;
17
+ private appTimer?: number;
18
18
 
19
19
  private mainViewProxy = this.manager.mainViewProxy;
20
20
  private displayer = this.manager.displayer;
@@ -133,7 +133,10 @@ export class ViewManager extends Base {
133
133
  public switchAppToWriter(id: string): void {
134
134
  this.freedomAllViews();
135
135
  // 为了同步端不闪烁, 需要给 room setScenePath 一个延迟
136
- setTimeout(() => {
136
+ if (this.appTimer) {
137
+ clearTimeout(this.appTimer);
138
+ }
139
+ this.appTimer = setTimeout(() => {
137
140
  const appProxy = this.manager.appProxies.get(id);
138
141
  if (appProxy) {
139
142
  if (this.manager.boxManager.teleBoxManager.minimized) return;