The current value: the stored one, or initialValue until one is stored.
Resolves once stored values have loaded: at once for localStorage, later for IndexedDB.
Stores a value or the result of an updater, like React's useState setter.
The store holding the value: the layer's store for its key, or its own memory store without an attribute.
Calls the listener after every change to the value's key; returns the function that stops it.
One persisted value, declared once and shared by components and plain functions. Components read it with
usePersistedState(state); code outside React callsget,setandsubscribe, which always see the current value.