Svelte’s lifecycle methods can be used anywhere
“I don’t think it’s widely known that you can call the Svelte lifecycle methods (onMount, onDestroy, beforeUpdate, afterUpdate) outside of a component. It is mentioned in the Svelte docs and tutorial, though it’s easy to gloss over.”
read »