@netless/window-manager 1.0.17 → 1.0.18
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 +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppManager.ts +13 -2
- package/src/Register/storage.ts +6 -3
- package/src/index.ts +11 -1
package/dist/index.mjs
CHANGED
|
@@ -125,8 +125,8 @@ const internalEmitter = new Emittery();
|
|
|
125
125
|
const DatabaseName = "__WindowManagerAppCache";
|
|
126
126
|
let db;
|
|
127
127
|
let store;
|
|
128
|
-
const initDb = async () => {
|
|
129
|
-
db = await createDb();
|
|
128
|
+
const initDb = async (onBlocked) => {
|
|
129
|
+
db = await createDb(onBlocked);
|
|
130
130
|
};
|
|
131
131
|
const setItem = (key, val) => {
|
|
132
132
|
if (!db)
|
|
@@ -138,12 +138,15 @@ const getItem = async (key) => {
|
|
|
138
138
|
return null;
|
|
139
139
|
return await query(db, key);
|
|
140
140
|
};
|
|
141
|
-
function createDb() {
|
|
141
|
+
function createDb(onBlocked) {
|
|
142
142
|
return new Promise((resolve, reject) => {
|
|
143
143
|
const request = indexedDB.open(DatabaseName, 2);
|
|
144
144
|
request.onerror = (e2) => {
|
|
145
145
|
reject(e2);
|
|
146
146
|
};
|
|
147
|
+
request.onblocked = () => {
|
|
148
|
+
onBlocked == null ? void 0 : onBlocked();
|
|
149
|
+
};
|
|
147
150
|
request.onupgradeneeded = (event) => {
|
|
148
151
|
const db2 = event.target.result;
|
|
149
152
|
if (!db2.objectStoreNames.contains("apps")) {
|
|
@@ -9109,11 +9112,19 @@ class AppManager {
|
|
|
9109
9112
|
return rect;
|
|
9110
9113
|
}
|
|
9111
9114
|
setMainViewFocusPath(scenePath) {
|
|
9112
|
-
var _a;
|
|
9115
|
+
var _a, _b;
|
|
9113
9116
|
const focusScenePath = scenePath || this.store.getMainViewScenePath();
|
|
9114
9117
|
if (focusScenePath) {
|
|
9115
|
-
|
|
9116
|
-
|
|
9118
|
+
try {
|
|
9119
|
+
setViewFocusScenePath(this.mainView, focusScenePath);
|
|
9120
|
+
return ((_a = this.mainView) == null ? void 0 : _a.focusScenePath) === focusScenePath;
|
|
9121
|
+
} catch (error) {
|
|
9122
|
+
const cause = error instanceof Error ? error : new Error(String(error));
|
|
9123
|
+
(_b = this.Logger) == null ? void 0 : _b.error(
|
|
9124
|
+
`[WindowManager]: set main view focus scene path failed, focusScenePath: ${focusScenePath}, didRelease: ${Boolean(this.mainView.didRelease)}, error: ${cause.message}, stack: ${cause.stack || ""}`
|
|
9125
|
+
);
|
|
9126
|
+
return false;
|
|
9127
|
+
}
|
|
9117
9128
|
}
|
|
9118
9129
|
}
|
|
9119
9130
|
resetScenePath(scenePath) {
|
|
@@ -10232,7 +10243,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
10232
10243
|
const _WindowManager = class extends InvisiblePlugin {
|
|
10233
10244
|
constructor(context) {
|
|
10234
10245
|
super(context);
|
|
10235
|
-
this.version = "1.0.
|
|
10246
|
+
this.version = "1.0.18";
|
|
10236
10247
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.56" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@netless/app-presentation": "^0.1.10", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.56" } };
|
|
10237
10248
|
this.emitter = callbacks;
|
|
10238
10249
|
this.viewMode = ViewMode.Broadcaster;
|
|
@@ -10273,7 +10284,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
10273
10284
|
_WindowManager._resolve(manager);
|
|
10274
10285
|
}
|
|
10275
10286
|
static async mount(params, extendClass) {
|
|
10276
|
-
var _a;
|
|
10287
|
+
var _a, _b, _c, _d, _e;
|
|
10277
10288
|
const room = params.room;
|
|
10278
10289
|
_WindowManager.container = params.container;
|
|
10279
10290
|
_WindowManager.supportAppliancePlugin = params.supportAppliancePlugin;
|
|
@@ -10310,8 +10321,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
10310
10321
|
}
|
|
10311
10322
|
}
|
|
10312
10323
|
if (_WindowManager.isCreated) {
|
|
10324
|
+
(_a = manager == null ? void 0 : manager._roomLogger) == null ? void 0 : _a.error(
|
|
10325
|
+
"[WindowManager] mount duplicate check failed: isCreated=true"
|
|
10326
|
+
);
|
|
10313
10327
|
throw new Error("[WindowManager]: Already created cannot be created again");
|
|
10314
10328
|
}
|
|
10329
|
+
(_b = manager == null ? void 0 : manager._roomLogger) == null ? void 0 : _b.info(
|
|
10330
|
+
`[WindowManager] mount duplicate check passed: isCreated=${_WindowManager.isCreated}`
|
|
10331
|
+
);
|
|
10315
10332
|
this.debug = Boolean(debug);
|
|
10316
10333
|
if (manager == null ? void 0 : manager._roomLogger) {
|
|
10317
10334
|
manager._roomLogger.info(
|
|
@@ -10377,9 +10394,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
10377
10394
|
);
|
|
10378
10395
|
}
|
|
10379
10396
|
try {
|
|
10380
|
-
|
|
10397
|
+
(_c = manager._roomLogger) == null ? void 0 : _c.info("[WindowManager] indexedDB open start");
|
|
10398
|
+
await initDb(() => {
|
|
10399
|
+
var _a2;
|
|
10400
|
+
(_a2 = manager == null ? void 0 : manager._roomLogger) == null ? void 0 : _a2.warn("[WindowManager] indexedDB open blocked");
|
|
10401
|
+
});
|
|
10402
|
+
(_d = manager._roomLogger) == null ? void 0 : _d.info("[WindowManager] indexedDB open success");
|
|
10381
10403
|
} catch (error) {
|
|
10382
|
-
(
|
|
10404
|
+
(_e = manager._roomLogger) == null ? void 0 : _e.warn(`[WindowManager] indexedDB open failed: ${error.message}`);
|
|
10383
10405
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
10384
10406
|
console.log(error);
|
|
10385
10407
|
}
|