Skip to content
On this page

tryOnScopeDispose

Category
Last Changed
3 months ago

Safe onScopeDispose. Call onScopeDispose() if it's inside a effect scope lifecycle, if not, do nothing

Usage

import { tryOnScopeDispose } from '@vueuse/core'

tryOnScopeDispose(() => {

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

tryOnScopeDispose(() => {

})

Type Declarations

/**
 * Call onScopeDispose() if it's inside a effect scope lifecycle, if not, do nothing
 *
 * @param fn
 */
export declare function tryOnScopeDispose(fn: Fn): boolean
/**
 * Call onScopeDispose() if it's inside a effect scope lifecycle, if not, do nothing
 *
 * @param fn
 */
export declare function tryOnScopeDispose(fn: Fn): boolean

Source

SourceDocs

Contributors

Anthony Fu
Peter Shih

Changelog

v6.0.0-beta.2 on 8/9/2021
ff21b - feat: use tryOnScopeDispose instead of tryOnUnmounted
tryOnScopeDispose has loaded