put second argument section back with its code sample

pull/3276/head
Rich Harris 5 years ago committed by GitHub
parent d56e0d5080
commit 8851d79533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -231,8 +231,6 @@ Function that creates a store which has values that can be set from 'outside' co
`update` is a method that takes one argument which is a callback. The callback takes the existing store value as its argument and returns the new value to be set to the store.
If a function is passed as the second argument to the `writable` function, it will be called when the number of subscribers goes from zero to one (but not from one to two, etc). That function will be passed a `set` function which changes the value of the store. It must return a `stop` function that is called when the subscriber count goes from one to zero.
```js
import { writable } from 'svelte/store';
@ -249,6 +247,7 @@ count.update(n => n + 1); // logs '2'
---
If a function is passed as the second argument to the `writable` function, it will be called when the number of subscribers goes from zero to one (but not from one to two, etc). That function will be passed a `set` function which changes the value of the store. It must return a `stop` function that is called when the subscriber count goes from one to zero.
```js
import { writable } from 'svelte/store';

Loading…
Cancel
Save