more explanations

the unsubscribe needs to be explained here. In the API docs it says "will be unsubscribed when appropriate" when using $ store prefix, but it's not clear what does "appropriate" means.   
The API full note: "Any time you have a reference to a store, you can access its value inside a component by prefixing it with the $ character. This causes Svelte to declare the prefixed variable, and set up a store subscription that will be unsubscribed when appropriate."
pull/5132/head
Mo 5 years ago committed by GitHub
parent d19bcef690
commit f3900684a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,6 +6,8 @@ As long as an object correctly implements the `subscribe` method, it's a store.
For example, the `count` store from our earlier example could include `increment`, `decrement` and `reset` methods and avoid exposing `set` and `update`: For example, the `count` store from our earlier example could include `increment`, `decrement` and `reset` methods and avoid exposing `set` and `update`:
[more explanations here]
```js ```js
function createCount() { function createCount() {
const { subscribe, set, update } = writable(0); const { subscribe, set, update } = writable(0);

Loading…
Cancel
Save