fuxt
fuxt copied to clipboard
fuxt - useEventListener
I've seen a few places in UCLA that they forgot to remove event listener when component unmounts, which can lead to memory leaks etc.
I added a simple composable that automatically adds/removes event listener using onMount/onBeforeUnmount which can be useful for us as well.
Since we are using Vite with our Nuxt3 apps, Vite will perform tree shaking when building a project and get rid of unused code (including custom composables as well) and will not include them in the final bundle