Skip to content

Commit e460acc

Browse files
[docs] Rename a variable count_value to countValue in the Stores section (#7180)
1 parent 68dd118 commit e460acc

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

site/content/examples/07-stores/00-writable-stores/App.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import Decrementer from './Decrementer.svelte';
55
import Resetter from './Resetter.svelte';
66
7-
let count_value;
7+
let countValue;
88
99
const unsubscribe = count.subscribe(value => {
10-
count_value = value;
10+
countValue = value;
1111
});
1212
</script>
1313

14-
<h1>The count is {count_value}</h1>
14+
<h1>The count is {countValue}</h1>
1515

1616
<Incrementer/>
1717
<Decrementer/>

site/content/tutorial/08-stores/01-writable-stores/app-a/App.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import Decrementer from './Decrementer.svelte';
55
import Resetter from './Resetter.svelte';
66
7-
let count_value;
7+
let countValue;
88
99
count.subscribe(value => {
10-
count_value = value;
10+
countValue = value;
1111
});
1212
</script>
1313

14-
<h1>The count is {count_value}</h1>
14+
<h1>The count is {countValue}</h1>
1515

1616
<Incrementer/>
1717
<Decrementer/>

site/content/tutorial/08-stores/01-writable-stores/app-b/App.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import Decrementer from './Decrementer.svelte';
55
import Resetter from './Resetter.svelte';
66
7-
let count_value;
7+
let countValue;
88
99
count.subscribe(value => {
10-
count_value = value;
10+
countValue = value;
1111
});
1212
</script>
1313

14-
<h1>The count is {count_value}</h1>
14+
<h1>The count is {countValue}</h1>
1515

1616
<Incrementer/>
1717
<Decrementer/>

site/content/tutorial/08-stores/01-writable-stores/text.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Writable stores
44

55
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.
66

7-
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.
7+
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.
88

99
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`.
1010

site/content/tutorial/08-stores/02-auto-subscriptions/app-a/App.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import Decrementer from './Decrementer.svelte';
55
import Resetter from './Resetter.svelte';
66
7-
let count_value;
7+
let countValue;
88
99
count.subscribe(value => {
10-
count_value = value;
10+
countValue = value;
1111
});
1212
</script>
1313

14-
<h1>The count is {count_value}</h1>
14+
<h1>The count is {countValue}</h1>
1515

1616
<Incrementer/>
1717
<Decrementer/>

site/content/tutorial/08-stores/02-auto-subscriptions/text.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Start by declaring `unsubscribe` in `App.svelte`:
88

99
```js
1010
const unsubscribe = count.subscribe(value => {
11-
count_value = value;
11+
countValue = value;
1212
});
1313
```
1414
> 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
2323
import Decrementer from './Decrementer.svelte';
2424
import Resetter from './Resetter.svelte';
2525
26-
let count_value;
26+
let countValue;
2727
2828
const unsubscribe = count.subscribe(value => {
29-
count_value = value;
29+
countValue = value;
3030
});
3131
3232
onDestroy(unsubscribe);
3333
</script>
3434

35-
<h1>The count is {count_value}</h1>
35+
<h1>The count is {countValue}</h1>
3636
```
3737

3838
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 `$`:

0 commit comments

Comments
 (0)