@netless/app-slide 0.0.49 → 0.0.53
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.d.ts +1 -1
- package/dist/main.cjs.js +177 -177
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2976 -3104
- package/dist/main.es.js.map +1 -1
- package/dist/main.iife.js +247 -247
- package/dist/main.iife.js.map +1 -1
- package/dist/utils/freezer.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.ts +4 -3
- package/src/utils/freezer.ts +2 -0
package/dist/utils/freezer.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/app-slide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"main": "dist/main.cjs.js",
|
|
5
5
|
"module": "dist/main.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@netless/app-shared": "^0.1.1",
|
|
14
|
-
"@netless/slide": "^0.1
|
|
14
|
+
"@netless/slide": "^0.2.1",
|
|
15
15
|
"@types/color-string": "^1.5.2",
|
|
16
16
|
"color-string": "^1.9.0",
|
|
17
17
|
"side-effect-manager": "^0.1.5",
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { RoomState } from "white-web-sdk";
|
|
|
3
3
|
import type { MountSlideOptions } from "./SlideDocsViewer";
|
|
4
4
|
import type { Attributes } from "./typings";
|
|
5
5
|
import type { AddHooks, FreezableSlide } from "./utils/freezer";
|
|
6
|
+
import { useFreezer } from "./utils/freezer";
|
|
6
7
|
|
|
7
8
|
import { SideEffectManager } from "side-effect-manager";
|
|
8
9
|
import { ensureAttributes } from "@netless/app-shared";
|
|
@@ -22,7 +23,7 @@ export { SlidePreviewer, default as previewSlide } from "./SlidePreviewer";
|
|
|
22
23
|
|
|
23
24
|
export type { Attributes, AddHooks, FreezableSlide };
|
|
24
25
|
|
|
25
|
-
export const version = "0.0.
|
|
26
|
+
export const version = "0.0.53";
|
|
26
27
|
|
|
27
28
|
export { DefaultUrl, apps, FreezerLength, addHooks };
|
|
28
29
|
|
|
@@ -78,7 +79,7 @@ const SlideApp: NetlessApp<Attributes> = {
|
|
|
78
79
|
...options,
|
|
79
80
|
onPageChanged,
|
|
80
81
|
});
|
|
81
|
-
apps.set(context.appId, slideController);
|
|
82
|
+
if (useFreezer) apps.set(context.appId, slideController);
|
|
82
83
|
(logger.apps[context.appId] ||= {}).controller = slideController;
|
|
83
84
|
if (import.meta.env.DEV) {
|
|
84
85
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -125,7 +126,7 @@ const SlideApp: NetlessApp<Attributes> = {
|
|
|
125
126
|
|
|
126
127
|
context.emitter.on("destroy", () => {
|
|
127
128
|
log("[Slide]: destroy");
|
|
128
|
-
apps.delete(context.appId);
|
|
129
|
+
if (useFreezer) apps.delete(context.appId);
|
|
129
130
|
sideEffect.flushAll();
|
|
130
131
|
if (docsViewer) {
|
|
131
132
|
docsViewer.destroy();
|
package/src/utils/freezer.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface FreezableSlide {
|
|
|
6
6
|
unfreeze: () => void;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export let useFreezer = false;
|
|
9
10
|
export const FreezerLength = 2;
|
|
10
11
|
|
|
11
12
|
export const apps = {
|
|
@@ -63,6 +64,7 @@ export type AddHooks = NonNullable<RegisterParams["addHooks"]>;
|
|
|
63
64
|
* So that it will automatically freeze the app when it is not in focus.
|
|
64
65
|
*/
|
|
65
66
|
export const addHooks: AddHooks = emitter => {
|
|
67
|
+
useFreezer = true;
|
|
66
68
|
emitter.on("focus", ({ appId }) => {
|
|
67
69
|
apps.focus(appId);
|
|
68
70
|
});
|