Svelte · Middle · Question 66 of 75
What does the second argument of readable do?
const time = readable(new Date(), (set) => {
const id = setInterval(() => set(new Date()), 1000);
return () => clearInterval(id);
});- ✓Correct answer: A start function called when the first subscriber appears; its returned function runs when the last one unsubscribes
- 2An equality function
- 3An initial value fallback
Explanation
This lazy setup and cleanup makes stores efficient wrappers for external sources.