tryOnBeforeUnmount
安全な`onBeforeUnmount`。コンポーネントのライフサイクル内にある場合は`onBeforeUnmount()`を呼び出し、そうでない場合は何も行いません。
使用方法
js
import { tryOnBeforeUnmount } from '@vueuse/core'
tryOnBeforeUnmount(() => {
})
型定義
typescript
/**
* Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
*
* @param fn
* @param target
*/
export declare function tryOnBeforeUnmount(fn: Fn, target?: any): void