Move collection to store module

This commit is contained in:
Jon Staab
2025-04-25 10:37:57 -07:00
parent d14ae2ce77
commit 37c0491d71
22 changed files with 325 additions and 987 deletions
+12
View File
@@ -0,0 +1,12 @@
import {Readable, Subscriber} from "svelte/store"
import {throttle} from "@welshman/lib"
export const throttled = <T, S extends Readable<T>>(delay: number, store: S) => {
if (delay) {
const {subscribe} = store
store = {...store, subscribe: (f: Subscriber<T>) => subscribe(throttle(delay, f))}
}
return store
}