A function that returns the current value.
A function that takes a notify function and returns a disposer. The notify function should be called when the value changes.
Optional
config: ValConfig<TValue>custom config for the val.
A readonly val.
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
const isDarkMode$ = from(
() => prefersDark.matches,
notify => {
prefersDark.addEventListener("change", notify);
return () => prefersDark.removeEventListener("change", notify);
},
);
Creates a readonly val from a getter function and a listener function.