@netless/window-manager 0.3.8-canary.2 → 0.3.8-canary.3
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.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/AppManager.ts +36 -13
- package/src/index.ts +1 -1
package/package.json
CHANGED
package/src/AppManager.ts
CHANGED
@@ -1,12 +1,24 @@
|
|
1
|
-
import
|
1
|
+
import pRetry from "p-retry";
|
2
|
+
import {
|
3
|
+
AppAttributes,
|
4
|
+
AppStatus,
|
5
|
+
Events,
|
6
|
+
MagixEventName
|
7
|
+
} from "./constants";
|
2
8
|
import { AppListeners } from "./AppListener";
|
3
9
|
import { AppProxy } from "./AppProxy";
|
4
10
|
import { AttributesDelegate } from "./AttributesDelegate";
|
11
|
+
import {
|
12
|
+
autorun,
|
13
|
+
isPlayer,
|
14
|
+
isRoom,
|
15
|
+
ScenePathType,
|
16
|
+
ViewVisionMode
|
17
|
+
} from "white-web-sdk";
|
5
18
|
import { BoxManager } from "./BoxManager";
|
6
19
|
import { callbacks, emitter } from "./index";
|
7
20
|
import { CameraStore } from "./Utils/CameraStore";
|
8
21
|
import { genAppId, makeValidScenePath, setScenePath } from "./Utils/Common";
|
9
|
-
import { autorun, isPlayer, isRoom, ScenePathType, ViewVisionMode } from "white-web-sdk";
|
10
22
|
import { log } from "./Utils/log";
|
11
23
|
import { MainViewProxy } from "./MainView";
|
12
24
|
import { onObjectRemoved, safeListenPropsUpdated } from "./Utils/Reactive";
|
@@ -117,16 +129,28 @@ export class AppManager {
|
|
117
129
|
for (const id in apps) {
|
118
130
|
if (!this.appProxies.has(id) && !this.appStatus.has(id)) {
|
119
131
|
const app = apps[id];
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
132
|
+
|
133
|
+
pRetry(async () => {
|
134
|
+
this.appStatus.set(id, AppStatus.StartCreate);
|
135
|
+
// 防御 appAttributes 有可能为 undefined 的情况,这里做一个重试
|
136
|
+
const appAttributes = this.attributes[id];
|
137
|
+
if (!appAttributes) {
|
138
|
+
throw new Error("appAttributes is undefined");
|
139
|
+
}
|
140
|
+
await this.baseInsertApp(
|
141
|
+
{
|
142
|
+
kind: app.kind,
|
143
|
+
options: app.options,
|
144
|
+
isDynamicPPT: app.isDynamicPPT,
|
145
|
+
},
|
146
|
+
id,
|
147
|
+
false
|
148
|
+
);
|
149
|
+
this.focusByAttributes(apps);
|
150
|
+
}, { retries: 3 }).catch(err => {
|
151
|
+
console.warn(`[WindowManager]: Insert App Error`, err);
|
152
|
+
this.appStatus.delete(id);
|
153
|
+
});
|
130
154
|
}
|
131
155
|
}
|
132
156
|
}
|
@@ -202,7 +226,6 @@ export class AppManager {
|
|
202
226
|
isAddApp: boolean,
|
203
227
|
focus?: boolean
|
204
228
|
) {
|
205
|
-
this.appStatus.set(appId, AppStatus.StartCreate);
|
206
229
|
if (this.appProxies.has(appId)) {
|
207
230
|
console.warn("[WindowManager]: app duplicate exists and cannot be created again");
|
208
231
|
return;
|
package/src/index.ts
CHANGED
@@ -169,7 +169,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
169
169
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
170
170
|
private static isCreated = false;
|
171
171
|
|
172
|
-
public version = "0.3.8-canary.
|
172
|
+
public version = "0.3.8-canary.3";
|
173
173
|
|
174
174
|
public appListeners?: AppListeners;
|
175
175
|
|