@annotorious/core
Advanced tools
Comparing version 3.0.0-pre-alpha-44 to 3.0.0-pre-alpha-45
{ | ||
"name": "@annotorious/core", | ||
"version": "3.0.0-pre-alpha-44", | ||
"version": "3.0.0-pre-alpha-45", | ||
"description": "Experimental rewrite of Annotorious", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -45,4 +45,4 @@ import type { Annotation } from './Annotation'; | ||
viewport?: ViewportState; | ||
viewport: ViewportState; | ||
} |
@@ -7,14 +7,21 @@ import { writable } from 'svelte/store'; | ||
const { subscribe, set } = writable<string[]>([]); | ||
let hasSubscribers = false; | ||
let inViewport: string[] = []; | ||
const { subscribe, set } = writable<string[]>([], () => { | ||
// Function is called when no. of subscribers goes from 0 to 1 | ||
console.log('subsc'); | ||
hasSubscribers = true; | ||
subscribe(updated => inViewport = updated); | ||
return () => { | ||
// Called when no. of subscribers goes to 0 | ||
hasSubscribers = false; | ||
} | ||
}); | ||
return { | ||
get inViewport() { return [...inViewport] }, | ||
get hasSubscribers() { return hasSubscribers }, | ||
subscribe, | ||
set | ||
set | ||
}; | ||
} |
42037
1043