Skip to content
On this page

tryOnBeforeUnmount

Category
Last Changed
3 months ago

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

Usage

import { tryOnBeforeUnmount } from '@vueuse/core'

tryOnBeforeUnmount(() => {

})
import { tryOnBeforeUnmount } from '@vueuse/core'

tryOnBeforeUnmount(() => {

})

Type Declarations

/**
 * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
 *
 * @param fn
 */
export declare function tryOnBeforeUnmount(fn: Fn): void
/**
 * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
 *
 * @param fn
 */
export declare function tryOnBeforeUnmount(fn: Fn): void

Source

SourceDocs

Contributors

Anthony Fu
Ngheizit

Changelog

v6.1.0 on 9/2/2021
f573b - feat: new function (#709)
tryOnBeforeUnmount has loaded