@netless/window-manager 1.0.13-beta.0 → 1.0.13-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.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/App/AppProxy.ts +3 -1
- package/src/AppManager.ts +10 -3
- package/src/index.ts +27 -2
package/package.json
CHANGED
package/src/App/AppProxy.ts
CHANGED
|
@@ -216,7 +216,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
216
216
|
}
|
|
217
217
|
setTimeout(async () => {
|
|
218
218
|
// 延迟执行 setup, 防止初始化的属性没有更新成功
|
|
219
|
-
|
|
219
|
+
this.Logger?.info(`[WindowManager]: setup app ${this.kind}, appId: ${appId}`);
|
|
220
220
|
const result = await app.setup(context);
|
|
221
221
|
this.appResult = result;
|
|
222
222
|
appRegister.notifyApp(this.kind, "created", { appId, result });
|
|
@@ -538,6 +538,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
538
538
|
await appRegister.notifyApp(this.kind, "destroy", { appId: this.id });
|
|
539
539
|
await this.appEmitter.emit("destroy", { error });
|
|
540
540
|
} catch (error) {
|
|
541
|
+
this.Logger?.error(`[WindowManager]: notifyApp error: ${error.message}`);
|
|
541
542
|
console.error("[WindowManager]: notifyApp error", error.message, error.stack);
|
|
542
543
|
}
|
|
543
544
|
this.appEmitter.clearListeners();
|
|
@@ -560,6 +561,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
560
561
|
this.manager.refresher.remove(this.stateKey);
|
|
561
562
|
this.manager.refresher.remove(`${this.id}-fullPath`);
|
|
562
563
|
this._prevFullPath = undefined;
|
|
564
|
+
this.Logger?.info(`[WindowManager]: destroy app ${this.kind} appId: ${this.id}`);
|
|
563
565
|
}
|
|
564
566
|
|
|
565
567
|
public close(): Promise<void> {
|
package/src/AppManager.ts
CHANGED
|
@@ -133,6 +133,7 @@ export class AppManager {
|
|
|
133
133
|
this.createRootDirScenesCallback();
|
|
134
134
|
|
|
135
135
|
appRegister.setSyncRegisterApp(payload => {
|
|
136
|
+
this.Logger?.info(`[WindowManager] syncRegisterApp ${JSON.stringify(payload)}`);
|
|
136
137
|
this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
|
|
137
138
|
});
|
|
138
139
|
}
|
|
@@ -602,7 +603,9 @@ export class AppManager {
|
|
|
602
603
|
try {
|
|
603
604
|
const appAttributes = this.attributes[id];
|
|
604
605
|
if (!appAttributes) {
|
|
605
|
-
this.Logger?.error(
|
|
606
|
+
this.Logger?.error(
|
|
607
|
+
`[WindowManager]: appAttributes is undefined, appId: ${id}`
|
|
608
|
+
);
|
|
606
609
|
throw new Error("appAttributes is undefined");
|
|
607
610
|
}
|
|
608
611
|
|
|
@@ -725,7 +728,9 @@ export class AppManager {
|
|
|
725
728
|
|
|
726
729
|
public async addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined> {
|
|
727
730
|
log("addApp", params);
|
|
728
|
-
this.windowManger.Logger?.info(
|
|
731
|
+
this.windowManger.Logger?.info(
|
|
732
|
+
`[WindowManager]: addApp ${params.kind}, isDynamicPPT: ${isDynamicPPT}`
|
|
733
|
+
);
|
|
729
734
|
const { appId, needFocus } = await this.beforeAddApp(params, isDynamicPPT);
|
|
730
735
|
const appProxy = await this.baseInsertApp(params, appId, true, needFocus);
|
|
731
736
|
this.afterAddApp(appProxy);
|
|
@@ -774,7 +779,9 @@ export class AppManager {
|
|
|
774
779
|
focus?: boolean
|
|
775
780
|
) {
|
|
776
781
|
if (this.appProxies.has(appId)) {
|
|
777
|
-
this.windowManger.Logger?.warn(
|
|
782
|
+
this.windowManger.Logger?.warn(
|
|
783
|
+
`[WindowManager]: app duplicate exists and cannot be created again, appId: ${appId}`
|
|
784
|
+
);
|
|
778
785
|
return;
|
|
779
786
|
}
|
|
780
787
|
const AppProxyClass = getExtendClass(AppProxy, WindowManager.extendClass);
|
package/src/index.ts
CHANGED
|
@@ -286,8 +286,14 @@ export class WindowManager
|
|
|
286
286
|
manager = await this.initManager(room);
|
|
287
287
|
if (manager) {
|
|
288
288
|
manager._roomLogger = (room as unknown as { logger: Logger }).logger;
|
|
289
|
+
if (WindowManager.registered.size > 0) {
|
|
290
|
+
manager._roomLogger.info(
|
|
291
|
+
`[WindowManager] registered apps: ${JSON.stringify(
|
|
292
|
+
Array.from(WindowManager.registered.keys())
|
|
293
|
+
)}`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
289
296
|
}
|
|
290
|
-
|
|
291
297
|
}
|
|
292
298
|
if (WindowManager.isCreated) {
|
|
293
299
|
throw new Error("[WindowManager]: Already created cannot be created again");
|
|
@@ -297,7 +303,13 @@ export class WindowManager
|
|
|
297
303
|
if (this.debug) {
|
|
298
304
|
setOptions({ verbose: true });
|
|
299
305
|
}
|
|
300
|
-
|
|
306
|
+
if (manager?._roomLogger) {
|
|
307
|
+
manager._roomLogger.info(
|
|
308
|
+
`[WindowManager] Already insert room version: ${manager.version}`
|
|
309
|
+
);
|
|
310
|
+
} else {
|
|
311
|
+
log("Already insert room", manager);
|
|
312
|
+
}
|
|
301
313
|
|
|
302
314
|
if (isRoom(this.displayer)) {
|
|
303
315
|
if (!manager) {
|
|
@@ -356,12 +368,25 @@ export class WindowManager
|
|
|
356
368
|
replaceRoomFunction(room, manager);
|
|
357
369
|
internalEmitter.emit("onCreated");
|
|
358
370
|
WindowManager.isCreated = true;
|
|
371
|
+
if (
|
|
372
|
+
manager._roomLogger &&
|
|
373
|
+
manager.attributes.registered &&
|
|
374
|
+
Object.keys(manager.attributes.registered).length > 0
|
|
375
|
+
) {
|
|
376
|
+
manager._roomLogger.info(
|
|
377
|
+
`[WindowManager] attributes registered apps: ${JSON.stringify(
|
|
378
|
+
Array.from(Object.keys(manager.attributes.registered))
|
|
379
|
+
)}`
|
|
380
|
+
);
|
|
381
|
+
}
|
|
359
382
|
try {
|
|
360
383
|
await initDb();
|
|
361
384
|
} catch (error) {
|
|
385
|
+
manager._roomLogger?.warn(`[WindowManager] indexedDB open failed: ${error.message}`);
|
|
362
386
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
363
387
|
console.log(error);
|
|
364
388
|
}
|
|
389
|
+
|
|
365
390
|
return manager;
|
|
366
391
|
}
|
|
367
392
|
|