mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
271 B
21 lines
271 B
5 years ago
|
<script>
|
||
|
import { onMount } from 'svelte';
|
||
|
|
||
|
let a, b, c;
|
||
|
|
||
|
onMount(() => {
|
||
|
const interval = setInterval(() => {
|
||
|
b += 1;
|
||
|
c += 1;
|
||
|
|
||
|
console.log(b, c);
|
||
|
}, 1000);
|
||
|
|
||
|
return () => clearInterval(interval);
|
||
|
});
|
||
|
|
||
|
$: x = a * 2;
|
||
|
$: y = b * 2;
|
||
|
</script>
|
||
|
|
||
|
<p>{y}</p>
|