mirror of https://github.com/sveltejs/svelte
parent
787c34ceec
commit
b246192a91
@ -1,17 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import { count } from './stores.js';
|
import { counter } from './stores.js';
|
||||||
import Incrementer from './Incrementer.svelte';
|
import Incrementer from './Incrementer.svelte';
|
||||||
import Decrementer from './Decrementer.svelte';
|
import Decrementer from './Decrementer.svelte';
|
||||||
import Resetter from './Resetter.svelte';
|
import Resetter from './Resetter.svelte';
|
||||||
|
|
||||||
let count_value;
|
let counterValue;
|
||||||
|
|
||||||
const unsubscribe = count.subscribe(value => {
|
const unsubscribe = counter.subscribe(value => {
|
||||||
count_value = value;
|
counterValue = value;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The count is {count_value}</h1>
|
<h1>The counter is {counterValue}</h1>
|
||||||
|
|
||||||
<Incrementer/>
|
<Incrementer/>
|
||||||
<Decrementer/>
|
<Decrementer/>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const count = writable(0);
|
export const counter = writable(0);
|
||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const count = writable(0);
|
export const counter = writable(0);
|
||||||
@ -1,17 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
import { count } from './stores.js';
|
import { counter } from './stores.js';
|
||||||
import Incrementer from './Incrementer.svelte';
|
import Incrementer from './Incrementer.svelte';
|
||||||
import Decrementer from './Decrementer.svelte';
|
import Decrementer from './Decrementer.svelte';
|
||||||
import Resetter from './Resetter.svelte';
|
import Resetter from './Resetter.svelte';
|
||||||
|
|
||||||
let count_value;
|
let counterValue;
|
||||||
|
|
||||||
count.subscribe(value => {
|
counter.subscribe(value => {
|
||||||
count_value = value;
|
counterValue = value;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>The count is {count_value}</h1>
|
<h1>The counter is {counterValue}</h1>
|
||||||
|
|
||||||
<Incrementer/>
|
<Incrementer/>
|
||||||
<Decrementer/>
|
<Decrementer/>
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
export const count = writable(0);
|
export const counter = writable(0);
|
||||||
Loading…
Reference in new issue