主题
tryOnScopeDispose
安全 onScopeDispose
。如果 onScopeDispose()
在效果范围生命周期内,则调用 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(() => {
})
类型声明
typescript
/**
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
*
* @param fn
*/
export declare function tryOnScopeDispose(fn: Fn): boolean