From e460acc8f1aa76e66234393c6380e2f6b5e57272 Mon Sep 17 00:00:00 2001 From: NazarLazarchuk Date: Thu, 27 Jan 2022 12:13:25 +0200 Subject: [PATCH] [docs] Rename a variable `count_value` to `countValue` in the `Stores` section (#7180) --- .../examples/07-stores/00-writable-stores/App.svelte | 6 +++--- .../08-stores/01-writable-stores/app-a/App.svelte | 6 +++--- .../08-stores/01-writable-stores/app-b/App.svelte | 6 +++--- .../content/tutorial/08-stores/01-writable-stores/text.md | 2 +- .../08-stores/02-auto-subscriptions/app-a/App.svelte | 6 +++--- .../tutorial/08-stores/02-auto-subscriptions/text.md | 8 ++++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/site/content/examples/07-stores/00-writable-stores/App.svelte b/site/content/examples/07-stores/00-writable-stores/App.svelte index ee542f789d..61e55401a5 100644 --- a/site/content/examples/07-stores/00-writable-stores/App.svelte +++ b/site/content/examples/07-stores/00-writable-stores/App.svelte @@ -4,14 +4,14 @@ import Decrementer from './Decrementer.svelte'; import Resetter from './Resetter.svelte'; - let count_value; + let countValue; const unsubscribe = count.subscribe(value => { - count_value = value; + countValue = value; }); -

The count is {count_value}

+

The count is {countValue}

diff --git a/site/content/tutorial/08-stores/01-writable-stores/app-a/App.svelte b/site/content/tutorial/08-stores/01-writable-stores/app-a/App.svelte index f2a4023f25..481b3070dc 100644 --- a/site/content/tutorial/08-stores/01-writable-stores/app-a/App.svelte +++ b/site/content/tutorial/08-stores/01-writable-stores/app-a/App.svelte @@ -4,14 +4,14 @@ import Decrementer from './Decrementer.svelte'; import Resetter from './Resetter.svelte'; - let count_value; + let countValue; count.subscribe(value => { - count_value = value; + countValue = value; }); -

The count is {count_value}

+

The count is {countValue}

diff --git a/site/content/tutorial/08-stores/01-writable-stores/app-b/App.svelte b/site/content/tutorial/08-stores/01-writable-stores/app-b/App.svelte index c77563e354..57bbde1c1e 100644 --- a/site/content/tutorial/08-stores/01-writable-stores/app-b/App.svelte +++ b/site/content/tutorial/08-stores/01-writable-stores/app-b/App.svelte @@ -4,14 +4,14 @@ import Decrementer from './Decrementer.svelte'; import Resetter from './Resetter.svelte'; - let count_value; + let countValue; count.subscribe(value => { - count_value = value; + countValue = value; }); -

The count is {count_value}

+

The count is {countValue}

diff --git a/site/content/tutorial/08-stores/01-writable-stores/text.md b/site/content/tutorial/08-stores/01-writable-stores/text.md index 247ef86e8d..dc7081f46a 100644 --- a/site/content/tutorial/08-stores/01-writable-stores/text.md +++ b/site/content/tutorial/08-stores/01-writable-stores/text.md @@ -4,7 +4,7 @@ title: Writable stores Not all application state belongs inside your application's component hierarchy. Sometimes, you'll have values that need to be accessed by multiple unrelated components, or by a regular JavaScript module. -In Svelte, we do this with *stores*. A store is simply an object with a `subscribe` method that allows interested parties to be notified whenever the store value changes. In `App.svelte`, `count` is a store, and we're setting `count_value` in the `count.subscribe` callback. +In Svelte, we do this with *stores*. A store is simply an object with a `subscribe` method that allows interested parties to be notified whenever the store value changes. In `App.svelte`, `count` is a store, and we're setting `countValue` in the `count.subscribe` callback. Click the `stores.js` tab to see the definition of `count`. It's a *writable* store, which means it has `set` and `update` methods in addition to `subscribe`. diff --git a/site/content/tutorial/08-stores/02-auto-subscriptions/app-a/App.svelte b/site/content/tutorial/08-stores/02-auto-subscriptions/app-a/App.svelte index f2a4023f25..481b3070dc 100644 --- a/site/content/tutorial/08-stores/02-auto-subscriptions/app-a/App.svelte +++ b/site/content/tutorial/08-stores/02-auto-subscriptions/app-a/App.svelte @@ -4,14 +4,14 @@ import Decrementer from './Decrementer.svelte'; import Resetter from './Resetter.svelte'; - let count_value; + let countValue; count.subscribe(value => { - count_value = value; + countValue = value; }); -

The count is {count_value}

+

The count is {countValue}

diff --git a/site/content/tutorial/08-stores/02-auto-subscriptions/text.md b/site/content/tutorial/08-stores/02-auto-subscriptions/text.md index fc7967f658..2bed4a67d1 100644 --- a/site/content/tutorial/08-stores/02-auto-subscriptions/text.md +++ b/site/content/tutorial/08-stores/02-auto-subscriptions/text.md @@ -8,7 +8,7 @@ Start by declaring `unsubscribe` in `App.svelte`: ```js const unsubscribe = count.subscribe(value => { - count_value = value; + countValue = value; }); ``` > Calling a `subscribe` method returns an `unsubscribe` function. @@ -23,16 +23,16 @@ You now declared `unsubscribe`, but it still needs to be called, for example thr import Decrementer from './Decrementer.svelte'; import Resetter from './Resetter.svelte'; - let count_value; + let countValue; const unsubscribe = count.subscribe(value => { - count_value = value; + countValue = value; }); onDestroy(unsubscribe); -

The count is {count_value}

+

The count is {countValue}

``` It starts to get a bit boilerplatey though, especially if your component subscribes to multiple stores. Instead, Svelte has a trick up its sleeve — you can reference a store value by prefixing the store name with `$`: