watchOnce
A watcher for readables but runs only once.
Demo
Store value:
0
(Check console)
Usage
<script lang="ts">
import { watchOnce } from "svelte-legos";
import { writable } from "svelte/store";
const counter = writable(0);
watchOnce(counter, (counter) => {
console.log(counter);
});
</script>