@netless/window-manager 1.0.4 → 1.0.5-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.d.ts +1 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/AppManager.ts +18 -2
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.5-beta.1",
|
4
4
|
"description": "Multi-window mode for Netless Whiteboard",
|
5
5
|
"author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
|
6
6
|
"license": "MIT",
|
@@ -32,7 +32,7 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@juggle/resize-observer": "^3.3.1",
|
35
|
-
"@netless/telebox-insider": "0.2.
|
35
|
+
"@netless/telebox-insider": "0.2.32-beta.1",
|
36
36
|
"emittery": "^0.9.2",
|
37
37
|
"lodash": "^4.17.21",
|
38
38
|
"p-retry": "^4.6.1",
|
@@ -72,6 +72,6 @@
|
|
72
72
|
"typescript": "^4.5.5",
|
73
73
|
"vite": "^2.9.9",
|
74
74
|
"vitest": "^0.14.1",
|
75
|
-
"white-web-sdk": "2.16.52"
|
75
|
+
"white-web-sdk": "^2.16.52"
|
76
76
|
}
|
77
77
|
}
|
package/src/AppManager.ts
CHANGED
@@ -67,6 +67,8 @@ export class AppManager {
|
|
67
67
|
private callbacksNode: ScenesCallbacksNode | null = null;
|
68
68
|
private appCreateQueue = new AppCreateQueue();
|
69
69
|
|
70
|
+
private _focusAppCreatedResolve?: (appProxy: AppProxy) => void;
|
71
|
+
|
70
72
|
private sideEffectManager = new SideEffectManager();
|
71
73
|
|
72
74
|
public sceneState: SceneState | null = null;
|
@@ -319,7 +321,15 @@ export class AppManager {
|
|
319
321
|
}
|
320
322
|
|
321
323
|
private async onCreated() {
|
324
|
+
if (Object.keys(this.attributes.apps).length && this.store.focus) {
|
325
|
+
await new Promise<AppProxy>(resolve => {
|
326
|
+
this._focusAppCreatedResolve = resolve;
|
327
|
+
}).then(() => {
|
328
|
+
this.focusByAttributes(this.attributes.apps);
|
329
|
+
});
|
330
|
+
}
|
322
331
|
await this.attributesUpdateCallback(this.attributes.apps);
|
332
|
+
this.focusByAttributes(this.attributes.apps);
|
323
333
|
internalEmitter.emit("updateManagerRect");
|
324
334
|
boxEmitter.on("move", this.onBoxMove);
|
325
335
|
boxEmitter.on("resize", this.onBoxResize);
|
@@ -512,9 +522,10 @@ export class AppManager {
|
|
512
522
|
if (!appAttributes) {
|
513
523
|
throw new Error("appAttributes is undefined");
|
514
524
|
}
|
515
|
-
|
525
|
+
|
526
|
+
this.appCreateQueue.push<AppProxy>(async() => {
|
516
527
|
this.appStatus.set(id, AppStatus.StartCreate);
|
517
|
-
|
528
|
+
const appProxy = await this.baseInsertApp(
|
518
529
|
{
|
519
530
|
kind: app.kind,
|
520
531
|
options: app.options,
|
@@ -523,6 +534,10 @@ export class AppManager {
|
|
523
534
|
id,
|
524
535
|
false
|
525
536
|
);
|
537
|
+
if (appProxy &&this.store.focus === id && this._focusAppCreatedResolve) {
|
538
|
+
this._focusAppCreatedResolve(appProxy);
|
539
|
+
}
|
540
|
+
return appProxy;
|
526
541
|
});
|
527
542
|
this.focusByAttributes(apps);
|
528
543
|
} catch (error) {
|
@@ -845,5 +860,6 @@ export class AppManager {
|
|
845
860
|
this.sideEffectManager.flushAll();
|
846
861
|
this._prevFocused = undefined;
|
847
862
|
this._prevSceneIndex = undefined;
|
863
|
+
this._focusAppCreatedResolve = undefined;
|
848
864
|
}
|
849
865
|
}
|