svelte checkifmounted code example
Example: svelte lifecycle events
How to work with Lifecycle Events in Svelte
onMount fired after the component is rendered.
onDestroy fired after the component is destroyed.
beforeUpdate fired before the DOM is updated.
afterUpdate fired after the DOM is updated.