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.
svelte/test/sourcemaps/samples/typescript/input.svelte

19 lines
368 B

<script lang="ts">
import { onMount } from 'svelte';
let count: number = 0;
interface ITimeoutDestroyer {
(): void; // send timeout to the void!
}
onMount(() => {
const id = setInterval(() => count++, 1000);
const clear: ITimeoutDestroyer = () => clearInterval(id);
return clear;
});
</script>
<h1>Hello world!</h1>
<div>Counter value: {count}</div>