@netless/app-slide 0.2.105-beta.1 → 0.2.105-beta.2
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/main.cjs.js +130 -130
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +41 -1
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +128 -128
- package/dist/main.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +43 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -202,6 +202,9 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> & {
|
|
|
202
202
|
(window as any).slideController = slideController;
|
|
203
203
|
}
|
|
204
204
|
slideController.readyPromise.then(options.onReady).then(() => {
|
|
205
|
+
// Teardown may have destroyed the box while this deferred callback
|
|
206
|
+
// was pending; syncing scenes against a destroyed app throws.
|
|
207
|
+
if (disposed) return;
|
|
205
208
|
const room = context.getRoom();
|
|
206
209
|
let synced = false;
|
|
207
210
|
if (room && context.getIsWritable()) {
|
|
@@ -266,6 +269,46 @@ const SlideApp: NetlessApp<Attributes, MagixEvents, AppOptions, AppResult> & {
|
|
|
266
269
|
});
|
|
267
270
|
}
|
|
268
271
|
|
|
272
|
+
// Blur freeze (same semantics as the Presentation blur thumbnail
|
|
273
|
+
// degradation): while the app is cached and loses focus in a
|
|
274
|
+
// maximized/minimized workspace, freeze the slide (destroy the player,
|
|
275
|
+
// keep a snapshot); on focus, unfreeze. Freezing is skipped in normal
|
|
276
|
+
// mode where several windows are visible side by side. The whole flow is
|
|
277
|
+
// a lazy-mode-only cache optimization: inactive unless the WindowManager
|
|
278
|
+
// runs with lazySetupInMaximizedMode enabled (read dynamically — lazy can
|
|
279
|
+
// be disabled at runtime, e.g. when forceMaximized is cleared).
|
|
280
|
+
const isLazySetupMode = (): boolean =>
|
|
281
|
+
(context.getWindowManager() as any)?.lazySetupInMaximizedMode === true;
|
|
282
|
+
const isBlurFreezeAllowed = (): boolean => {
|
|
283
|
+
const boxStatus = context.getBoxStatus();
|
|
284
|
+
if (boxStatus) return boxStatus !== "normal";
|
|
285
|
+
const boxState = context.getWindowManager()?.boxState;
|
|
286
|
+
return boxState != null && boxState !== "normal";
|
|
287
|
+
};
|
|
288
|
+
sideEffect.add(
|
|
289
|
+
() =>
|
|
290
|
+
context.emitter.on("focus", (isFocused: boolean) => {
|
|
291
|
+
if (disposed) return;
|
|
292
|
+
if (!isLazySetupMode()) return;
|
|
293
|
+
const controller = docsViewer?.slideController;
|
|
294
|
+
if (!controller) return;
|
|
295
|
+
if (!isFocused) {
|
|
296
|
+
if (!isBlurFreezeAllowed()) return;
|
|
297
|
+
if (!controller.isFrozen) {
|
|
298
|
+
log("[Slide] blur freeze", context.appId);
|
|
299
|
+
controller.freeze();
|
|
300
|
+
}
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (useFreezer) {
|
|
304
|
+
apps.focus(context.appId);
|
|
305
|
+
} else if (controller.isFrozen) {
|
|
306
|
+
log("[Slide] focus unfreeze", context.appId);
|
|
307
|
+
controller.unfreeze();
|
|
308
|
+
}
|
|
309
|
+
}),
|
|
310
|
+
);
|
|
311
|
+
|
|
269
312
|
let disposed = false;
|
|
270
313
|
let offDestroy: (() => void) | undefined;
|
|
271
314
|
const teardown = () => {
|