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);
});

Explanation

This lazy setup and cleanup makes stores efficient wrappers for external sources.

Further reading

Problem with a question

Svelte · Middle · question 66

Test yourself

Take the Svelte · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz