Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/tryOnUnmounted.md
1---2category: Component3---45# tryOnUnmounted67Safe `onUnmounted`. Call `onUnmounted()` if it's inside a component lifecycle, if not, do nothing89## Usage1011```ts12import { tryOnUnmounted } from '@vueuse/core'1314tryOnUnmounted(() => {1516})17```1819## Type Declarations2021```ts22/**23* Call onUnmounted() if it's inside a component lifecycle, if not, do nothing24*25* @param fn26* @param target27*/28export declare function tryOnUnmounted(29fn: Fn,30target?: ComponentInternalInstance | null,31): void32```33