Add comprehensive reference documentation for: - Vitest: environments, projects/workspaces, type testing, vi utilities - Pinia: HMR, Nuxt integration, SSR setup - Vue: built-in components (Transition, Teleport, Suspense, KeepAlive) and advanced directives
32 lines
492 B
Markdown
32 lines
492 B
Markdown
---
|
|
category: Component
|
|
---
|
|
|
|
# tryOnScopeDispose
|
|
|
|
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
|
|
```
|