Skip to content

tryOnUnmounted

Category
Export Size
144 B
Last Changed
5 months ago

Safe onUnmounted. Call onUnmounted() if it's inside a component lifecycle, if not, do nothing

Usage

ts
import { 
tryOnUnmounted
} from '@vueuse/core'
tryOnUnmounted
(() => {
})

Type Declarations

ts
/**
 * Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
 *
 * @param fn
 * @param target
 */
export declare function 
tryOnUnmounted
(
fn
:
Fn
,
target
?:
ComponentInternalInstance
| null,
): void

Source

SourceDocs

Contributors

Anthony Fu
Arthur Darkstone
SerKo
Anthony Fu
Doctorwu
qiang

Changelog

a49a3 - fix: update parameter types to use ComponentInternalInstance in lifec… (#5060)
59f75 - feat(toValue): deprecate toValue from @vueuse/shared in favor of Vue's native
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
ce420 - fix: fix tryOnMounted in vue2 (#3658)
f2aeb - feat(tryOnMounted): support target arguement (#3185)