From d7f6a908d52f95499fba9947a4387e060623617f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 24 Jul 2019 08:49:04 -0400 Subject: [PATCH] put second argument section back with its code sample --- site/content/docs/03-run-time.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 5d73bfdbcb..0c279874b9 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -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';