diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 9a8d6a69b555..19cdcfd25092 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -411,6 +411,29 @@ import { get } from 'svelte/store'; const value = get(store); ``` +#### `readonly` + +```js +readableStore = readonly(writableStore); +``` + +--- + +This simple helper function makes a store readonly. You can still subscribe to the changes from the original one using this new readable store. + + +```js +import { readonly } from 'svelte/store'; + +const writableStore = writable(1); +const readableStore = readonly(writableStore); + +readableStore.subscribe(console.log); + +writableStore.set(2); // console: 2 +readableStore.set(2); // ERROR +``` + ### `svelte/motion` @@ -788,7 +811,7 @@ The `crossfade` function creates a pair of [transitions](docs#transition_fn) cal * `delay` (`number`, default 0) — milliseconds before starting * `duration` (`number` | `function`, default 800) — milliseconds the transition lasts * `easing` (`function`, default `cubicOut`) — an [easing function](docs#svelte_easing) -* `fallback` (`function`) — A fallback [transition](docs#transition_fn) to use for send when there is no matching element being received, and for receive when there is no element being sent. +* `fallback` (`function`) — A fallback [transition](docs#transition_fn) to use for send when there is no matching element being received, and for receive when there is no element being sent. ```sv