@netless/window-manager 1.0.6-beta.3 → 1.0.7-beta.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": "1.0.6-beta.3",
3
+ "version": "1.0.7-beta.0",
4
4
  "description": "Multi-window mode for Netless Whiteboard",
5
5
  "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
6
  "license": "MIT",
package/src/AppManager.ts CHANGED
@@ -3,7 +3,7 @@ import { AppCreateQueue } from "./Utils/AppCreateQueue";
3
3
  import { AppListeners } from "./AppListener";
4
4
  import { AppProxy } from "./App";
5
5
  import { appRegister } from "./Register";
6
- import { autorun, isPlayer, isRoom, ScenePathType } from "white-web-sdk";
6
+ import { autorun, isPlayer, isRoom, ScenePathType, UpdateEventKind } from "white-web-sdk";
7
7
  import { boxEmitter } from "./BoxEmitter";
8
8
  import { calculateNextIndex } from "./Page";
9
9
  import { callbacks } from "./callback";
@@ -12,7 +12,7 @@ import { internalEmitter } from "./InternalEmitter";
12
12
  import { Fields, store } from "./AttributesDelegate";
13
13
  import { log } from "./Utils/log";
14
14
  import { MainViewProxy } from "./View/MainView";
15
- import { onObjectRemoved, safeListenPropsUpdated } from "./Utils/Reactive";
15
+ import { safeListenPropsUpdated } from "./Utils/Reactive";
16
16
  import { reconnectRefresher, WindowManager } from "./index";
17
17
  import { RedoUndo } from "./RedoUndo";
18
18
  import { SideEffectManager } from "side-effect-manager";
@@ -438,10 +438,20 @@ export class AppManager {
438
438
  };
439
439
 
440
440
  public addAppCloseListener = () => {
441
+ // this.refresher.add("appsClose", () => {
442
+ // return onObjectRemoved(this.attributes.apps, () => {
443
+ // this.onAppDelete(this.attributes.apps);
444
+ // });
445
+ // });
441
446
  this.refresher.add("appsClose", () => {
442
- return onObjectRemoved(this.attributes.apps, () => {
443
- this.onAppDelete(this.attributes.apps);
444
- });
447
+ return safeListenPropsUpdated(
448
+ () => this.attributes.apps,
449
+ events => {
450
+ if (events.some(e => e.kind === UpdateEventKind.Removed)) {
451
+ this.onAppDelete(this.attributes.apps);
452
+ }
453
+ }
454
+ );
445
455
  });
446
456
  };
447
457