@annotorious/core 3.0.0-pre-alpha-44 → 3.0.0-pre-alpha-45
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/package.json +1 -1
- package/src/model/core/Annotator.ts +1 -1
- package/src/state/Viewport.ts +12 -5
package/package.json
CHANGED
package/src/state/Viewport.ts
CHANGED
|
@@ -4,16 +4,23 @@ export type ViewportState = ReturnType<typeof createViewportState>;
|
|
|
4
4
|
|
|
5
5
|
export const createViewportState = () => {
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
let hasSubscribers = false;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const { subscribe, set } = writable<string[]>([], () => {
|
|
10
|
+
// Function is called when no. of subscribers goes from 0 to 1
|
|
11
|
+
console.log('subsc');
|
|
12
|
+
hasSubscribers = true;
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
return () => {
|
|
15
|
+
// Called when no. of subscribers goes to 0
|
|
16
|
+
hasSubscribers = false;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
12
19
|
|
|
13
20
|
return {
|
|
14
|
-
get
|
|
21
|
+
get hasSubscribers() { return hasSubscribers },
|
|
15
22
|
subscribe,
|
|
16
|
-
set
|
|
23
|
+
set
|
|
17
24
|
};
|
|
18
25
|
|
|
19
26
|
}
|