fuxt icon indicating copy to clipboard operation
fuxt copied to clipboard

fuxt - useEventListener

Open lux-v opened this issue 7 months ago • 3 comments

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

lux-v avatar Jun 27 '25 11:06 lux-v