Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

svelte on destroy

import { onDestroy } from 'svelte';

export function onInterval(callback, milliseconds) {
	const interval = setInterval(callback, milliseconds);

	onDestroy(() => {
		clearInterval(interval);
	});
}
Source by svelte.dev #
 
PREVIOUS NEXT
Tagged: #svelte #destroy
ADD COMMENT
Topic
Name
6+7 =