Vue 3 safe scope disposal with automatic cleanup
npm install vue-use-try-on-scope-dispose
A Vue 3 composition API utility that safely registers cleanup callbacks during component scope lifecycle. Automatically handles cleanup when scope is disposed, preventing memory leaks.
``bash`
npm install vue-use-try-on-scope-dispose
`ts
import { tryOnScopeDispose } from 'vue-use-try-on-scope-dispose'
tryOnScopeDispose(() => {
console.log('Cleanup called')
})
console.log('Handler registered')
``
MIT
Extracted from VueUse for standalone use.