You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Effect scope is an advanced API primarily intended for library authors. For details on how to leverage this API, please consult its corresponding [RFC](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md).
5
+
:::
6
+
7
+
## `effectScope`
8
+
9
+
Creates an effect scope object which can capture the reactive effects (e.g. computed and watchers) created within it so that these effects can be disposed together.
10
+
11
+
**Typing:**
12
+
13
+
```ts
14
+
function effectScope(detached?:boolean):EffectScope
15
+
16
+
interfaceEffectScope {
17
+
run<T>(fn: () =>T):T|undefined// undefined if scope is inactive
Thismethodcanbeusedasanon-component-coupledreplacementof`onUnmounted`inreusablecompositionfunctions, sinceeachVuecomponent's `setup()` function is also invoked in an effect scope.
0 commit comments