@netless/window-manager 0.4.0-canary.13 → 0.4.0-canary.14
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/App/Storage/index.d.ts +2 -1
- package/dist/App/Storage/typings.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/App/Storage/index.ts +6 -1
- package/src/App/Storage/typings.ts +4 -2
- package/src/View/ViewManager.ts +1 -2
- package/src/index.ts +4 -0
package/package.json
CHANGED
package/src/App/Storage/index.ts
CHANGED
@@ -4,7 +4,7 @@ import { SideEffectManager } from "side-effect-manager";
|
|
4
4
|
import type { AppContext } from "../../AppContext";
|
5
5
|
import { safeListenPropsUpdated } from "../../Utils/Reactive";
|
6
6
|
import { isRef, makeRef, plainObjectKeys } from "./utils";
|
7
|
-
import type { Diff, MaybeRefValue, RefValue, StorageStateChangedEvent } from "./typings";
|
7
|
+
import type { Diff, MaybeRefValue, RefValue, StorageStateChangedEvent, StorageStateChangedListener, StorageStateChangedListenerDisposer } from "./typings";
|
8
8
|
import { StorageEvent } from "./StorageEvent";
|
9
9
|
|
10
10
|
export * from './typings';
|
@@ -86,6 +86,11 @@ export class Storage<TState extends Record<string, any> = any> implements Storag
|
|
86
86
|
}
|
87
87
|
|
88
88
|
readonly onStateChanged = new StorageEvent<StorageStateChangedEvent<TState>>();
|
89
|
+
|
90
|
+
addStateChangedListener(handler: StorageStateChangedListener<TState>): StorageStateChangedListenerDisposer {
|
91
|
+
this.onStateChanged.addListener(handler);
|
92
|
+
return () => this.onStateChanged.removeListener(handler);
|
93
|
+
}
|
89
94
|
|
90
95
|
ensureState(state: Partial<TState>): void {
|
91
96
|
return this.setState(
|
@@ -16,6 +16,8 @@ export type StorageOnSetStatePayload<TState = unknown> = {
|
|
16
16
|
[K in keyof TState]?: MaybeRefValue<TState[K]>;
|
17
17
|
};
|
18
18
|
|
19
|
-
export type StorageStateChangedEvent<TState = any> = Diff<TState
|
19
|
+
export type StorageStateChangedEvent<TState = any> = Diff<TState>;
|
20
20
|
|
21
|
-
export type StorageStateChangedListener<TState = any> = StorageEventListener<StorageStateChangedEvent<TState
|
21
|
+
export type StorageStateChangedListener<TState = any> = StorageEventListener<StorageStateChangedEvent<TState>>;
|
22
|
+
|
23
|
+
export type StorageStateChangedListenerDisposer = () => void;
|
package/src/View/ViewManager.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { View
|
1
|
+
import type { View, Displayer } from "white-web-sdk";
|
2
2
|
|
3
3
|
export class ViewManager {
|
4
4
|
public views: Map<string, View> = new Map();
|
@@ -38,7 +38,6 @@ export class ViewManager {
|
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
41
|
-
|
42
41
|
export const createView = (displayer: Displayer): View => {
|
43
42
|
const view = displayer.views.createView();
|
44
43
|
setDefaultCameraBound(view);
|
package/src/index.ts
CHANGED
@@ -571,6 +571,10 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
571
571
|
return this.attributes.focus;
|
572
572
|
}
|
573
573
|
|
574
|
+
public get mainViewSceneIndex(): number {
|
575
|
+
return this.appManager?.store.getMainViewSceneIndex();
|
576
|
+
}
|
577
|
+
|
574
578
|
/**
|
575
579
|
* 查询所有的 App
|
576
580
|
*/
|