Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

svelte ondestroy

<script>
	import { onDestroy } from 'svelte';

	let counter = 0;
	const interval = setInterval(() => counter += 1, 1000);

	onDestroy(() => clearInterval(interval));
</script>
Source by svelte.dev #
 
PREVIOUS NEXT
Tagged: #svelte #ondestroy
ADD COMMENT
Topic
Name
7+5 =