Skip to content
On this page

tryOnBeforeUnmount

安全执行 onBeforeUnmount。如果在组件生命周期内,则调用 onBeforeUnmount(),如果不在,则什么都不做

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

Usage

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

tryOnBeforeUnmount(() => {

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

tryOnBeforeUnmount(() => {

})

Type Declarations

typescript
/**
 * 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

Category
Export Size
173 B
Last Changed
last year

SourceDocs

贡献者(Contributors)

日志(Changelog)

No recent changes

Released under the MIT License.