Initial value of a readable store.
Either an object with store options, or directly the onUse function.
The onUse function is a function called when the number of subscribers changes from 0 to 1 (but not called when the number of subscribers changes from 1 to 2, ...).
If a function is returned, it will be called when the number of subscribers changes from 1 to 0.
const clock = readable("00:00", setState => {
const intervalID = setInterval(() => {
const date = new Date();
setState(`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`);
}, 1000);
return () => clearInterval(intervalID);
});
Generated using TypeDoc
A convenience function to create Readable store instances.