:zap: Turbocharge your app with multithreaded Svelte Stores.
Demo/Documentation Site: https://svelte-worker-store.vercel.app/
What is this?
svelte-worker-store
is a small set of Svelte stores that enable you to use Web Workers to process things off the main thread.
Based on another library of mine (nanothreads), svelte-worker-store
is a tiny wrapper around an already tiny library.
derived
, pooled
and channel
stores npm install svelte-worker-store
pnpm install svelte-worker-store
<script>
// TODO: more examples
// Creates a store with a single worker
// and limits concurrent calls to 2.
const store = channel(add, 2);
const handleClick = () => store.send(1, 3);
</script>
<p>Output: {$store}</p>
<button on:click={handleClick}>Add numbers</button>