UNPKG

alinea

Version:
25 lines (23 loc) 511 B
import { atom } from "../../chunks/chunk-WJ67RR7S.js"; import "../../chunks/chunk-NZLE2WMY.js"; // src/dashboard/atoms/YAtom.ts function yAtom(yType, get) { const revision = atom(0); revision.onMount = (setAtom) => { const onChange = (events, tx) => { if (tx.origin === "self") return; setAtom((x) => x + 1); }; yType.observeDeep(onChange); return () => yType.unobserveDeep(onChange); }; return atom((g) => { g(revision); return get(); }); } export { yAtom };