@netless/window-manager 0.4.30-canary.0 → 0.4.30-canary.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/constants.d.ts +1 -0
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/App/AppProxy.ts +5 -0
- package/src/ReconnectRefresher.ts +18 -4
- package/src/constants.ts +1 -0
package/dist/index.es.js
CHANGED
@@ -47,6 +47,7 @@ var Events = /* @__PURE__ */ ((Events2) => {
|
|
47
47
|
return Events2;
|
48
48
|
})(Events || {});
|
49
49
|
const MagixEventName = "__WindowManger";
|
50
|
+
const EnsureReconnectEvent = "__WindowMangerEnsureReconnected__";
|
50
51
|
var AppAttributes = /* @__PURE__ */ ((AppAttributes2) => {
|
51
52
|
AppAttributes2["Size"] = "size";
|
52
53
|
AppAttributes2["Position"] = "position";
|
@@ -1506,6 +1507,11 @@ class AppProxy {
|
|
1506
1507
|
}
|
1507
1508
|
async onReconnected() {
|
1508
1509
|
var _a;
|
1510
|
+
const isExist = Boolean(this.manager.attributes.apps[this.id]);
|
1511
|
+
if (!isExist) {
|
1512
|
+
await this.destroy(true, false, true);
|
1513
|
+
return;
|
1514
|
+
}
|
1509
1515
|
this.appEmitter.emit("reconnected", void 0);
|
1510
1516
|
const currentAppState = this.getAppInitState(this.id);
|
1511
1517
|
await this.destroy(true, false, true);
|
@@ -5748,11 +5754,12 @@ class ReconnectRefresher {
|
|
5748
5754
|
this.reactors = /* @__PURE__ */ new Map();
|
5749
5755
|
this.disposers = /* @__PURE__ */ new Map();
|
5750
5756
|
this.onPhaseChanged = (phase) => {
|
5757
|
+
var _a;
|
5751
5758
|
if (phase === RoomPhase.Reconnecting) {
|
5752
5759
|
this.ctx.emitter.emit("startReconnect");
|
5753
5760
|
}
|
5754
5761
|
if (phase === RoomPhase.Connected && this.phase === RoomPhase.Reconnecting) {
|
5755
|
-
this.
|
5762
|
+
(_a = this.room) == null ? void 0 : _a.dispatchMagixEvent(EnsureReconnectEvent, {});
|
5756
5763
|
}
|
5757
5764
|
this.phase = phase;
|
5758
5765
|
};
|
@@ -5773,8 +5780,15 @@ class ReconnectRefresher {
|
|
5773
5780
|
setRoom(room) {
|
5774
5781
|
this.room = room;
|
5775
5782
|
this.phase = room == null ? void 0 : room.phase;
|
5776
|
-
|
5777
|
-
|
5783
|
+
if (room) {
|
5784
|
+
room.callbacks.off("onPhaseChanged", this.onPhaseChanged);
|
5785
|
+
room.callbacks.on("onPhaseChanged", this.onPhaseChanged);
|
5786
|
+
room.addMagixEventListener(EnsureReconnectEvent, (payload) => {
|
5787
|
+
if (payload.authorId === room.observerId) {
|
5788
|
+
this.onReconnected();
|
5789
|
+
}
|
5790
|
+
}, { fireSelfEventAfterCommit: true });
|
5791
|
+
}
|
5778
5792
|
}
|
5779
5793
|
setContext(ctx) {
|
5780
5794
|
this.ctx = ctx;
|
@@ -5816,8 +5830,9 @@ class ReconnectRefresher {
|
|
5816
5830
|
return this.reactors.has(id2);
|
5817
5831
|
}
|
5818
5832
|
destroy() {
|
5819
|
-
var _a;
|
5833
|
+
var _a, _b;
|
5820
5834
|
(_a = this.room) == null ? void 0 : _a.callbacks.off("onPhaseChanged", this.onPhaseChanged);
|
5835
|
+
(_b = this.room) == null ? void 0 : _b.removeMagixEventListener(EnsureReconnectEvent, this.onReconnected);
|
5821
5836
|
this.releaseDisposers();
|
5822
5837
|
}
|
5823
5838
|
}
|
@@ -15062,7 +15077,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15062
15077
|
const _WindowManager = class extends InvisiblePlugin {
|
15063
15078
|
constructor(context) {
|
15064
15079
|
super(context);
|
15065
|
-
this.version = "0.4.30-canary.
|
15080
|
+
this.version = "0.4.30-canary.1";
|
15066
15081
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^0.1.5", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@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.22", "@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", "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", "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", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.12.4", "white-web-sdk": "2.16.10" } };
|
15067
15082
|
this.emitter = callbacks$1;
|
15068
15083
|
this.viewMode = ViewMode.Broadcaster;
|