concept readable store in category svelte

appears as: Readable stores, readable store, readable store
Svelte and Sapper in Action

This is an excerpt from Manning's book Svelte and Sapper in Action.

import {readable} from 'svelte/store';
 
export const dogStore = readable([], set => {
  const res = await fetch('/dogs');
  const dogs = await res.json();
  set(dogs);
  return () => {};
});

The set function can use setInterval to continuously change the value of the store. For example, the readable store in the following listing provides numbers starting from 0 in increments of 10. The value changes every second.