Skip to content
On this page

tryOnScopeDispose

安全执行 onScopeDispose。如果它在effect作用域生命周期内,则调用 onScopeDispose(),如果不在,则什么都不做

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

Usage

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

tryOnScopeDispose(() => {

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

tryOnScopeDispose(() => {

})

Type Declarations

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

Source

Category
Export Size
183 B
Last Changed
2 months ago

SourceDocs

贡献者(Contributors)

日志(Changelog)

No recent changes

Released under the MIT License.