@netless/window-manager 1.0.7-beta.8 → 1.0.7-beta.9
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 +2 -0
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppManager.ts +21 -4
- package/src/Utils/extendClass.ts +1 -2
package/package.json
CHANGED
package/src/AppManager.ts
CHANGED
|
@@ -72,7 +72,9 @@ export class AppManager {
|
|
|
72
72
|
private callbacksNode: ScenesCallbacksNode | null = null;
|
|
73
73
|
private appCreateQueue = new AppCreateQueue();
|
|
74
74
|
|
|
75
|
-
private _focusAppCreatedResolve?: (appProxy
|
|
75
|
+
private _focusAppCreatedResolve?: (appProxy?: AppProxy) => void;
|
|
76
|
+
private _focusAppId: string | undefined;
|
|
77
|
+
private _resolveTimer: number | undefined;
|
|
76
78
|
|
|
77
79
|
private sideEffectManager = new SideEffectManager();
|
|
78
80
|
|
|
@@ -342,9 +344,16 @@ export class AppManager {
|
|
|
342
344
|
|
|
343
345
|
private async onCreated() {
|
|
344
346
|
if (Object.keys(this.attributes.apps).length && this.store.focus) {
|
|
345
|
-
|
|
347
|
+
this._focusAppId = this.store.focus;
|
|
348
|
+
console.log("onCreated===>", this._focusAppId);
|
|
349
|
+
await new Promise<AppProxy | undefined>(resolve => {
|
|
346
350
|
this._focusAppCreatedResolve = resolve;
|
|
351
|
+
this._resolveTimer = setTimeout(() => {
|
|
352
|
+
console.log("onCreated===>3333", this._focusAppId);
|
|
353
|
+
resolve(this.appProxies.get(this._focusAppId || ''));
|
|
354
|
+
}, 500);
|
|
347
355
|
}).then(() => {
|
|
356
|
+
console.log("onCreated===>2222", this._focusAppId);
|
|
348
357
|
this.focusByAttributes(this.attributes.apps);
|
|
349
358
|
});
|
|
350
359
|
}
|
|
@@ -595,7 +604,7 @@ export class AppManager {
|
|
|
595
604
|
if (!appAttributes) {
|
|
596
605
|
throw new Error("appAttributes is undefined");
|
|
597
606
|
}
|
|
598
|
-
|
|
607
|
+
|
|
599
608
|
this.appCreateQueue.push<AppProxy>(async () => {
|
|
600
609
|
this.appStatus.set(id, AppStatus.StartCreate);
|
|
601
610
|
const appProxy = await this.baseInsertApp(
|
|
@@ -612,9 +621,13 @@ export class AppManager {
|
|
|
612
621
|
);
|
|
613
622
|
if (
|
|
614
623
|
appProxy &&
|
|
615
|
-
this.
|
|
624
|
+
this._focusAppId === id &&
|
|
616
625
|
this._focusAppCreatedResolve
|
|
617
626
|
) {
|
|
627
|
+
console.log("onCreated===>4444", this._focusAppId);
|
|
628
|
+
if (this._resolveTimer) {
|
|
629
|
+
clearTimeout(this._resolveTimer);
|
|
630
|
+
}
|
|
618
631
|
this._focusAppCreatedResolve(appProxy);
|
|
619
632
|
}
|
|
620
633
|
return appProxy;
|
|
@@ -941,6 +954,10 @@ export class AppManager {
|
|
|
941
954
|
this.sideEffectManager.flushAll();
|
|
942
955
|
this._prevFocused = undefined;
|
|
943
956
|
this._prevSceneIndex = undefined;
|
|
957
|
+
if (this._resolveTimer) {
|
|
958
|
+
clearTimeout(this._resolveTimer);
|
|
959
|
+
}
|
|
944
960
|
this._focusAppCreatedResolve = undefined;
|
|
961
|
+
this._resolveTimer = undefined;
|
|
945
962
|
}
|
|
946
963
|
}
|