Skip to content

tryOnScopeDispose

Category
Export Size
125 B
Last Changed
last month

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

Usage

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

Type Declarations

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

Source

SourceDocs

Contributors

Anthony Fu
Arthur Darkstone
SerKo
Anthony Fu
ByMykel
Peter Shih

Changelog

v14.0.0 on
a4862 - fix: add optional failSilently parameter and updat… (#5061)
v12.0.0-beta.1 on
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)

Released under the MIT License.

FREE WEEKEND
Unlimited access to ALL Vue School courses
8-9 November 2025
Reserve Your Spot
8-9 November 2025