MCPcopy
hub / github.com/vuejs/core / constructor

Method constructor

packages/reactivity/src/effect.ts:116–131  ·  view source on GitHub ↗
(public fn: () => T)

Source from the content-addressed store, hash-verified

114 onTrigger?: (event: DebuggerEvent) => void
115
116 constructor(public fn: () => T) {
117 if (activeEffectScope) {
118 if (activeEffectScope.active) {
119 activeEffectScope.effects.push(this)
120 } else {
121 // The active scope has already been stopped. This happens when a
122 // component's setup is resumed after a top-level `await` (via the
123 // compiler-emitted `__restore()` from `withAsyncContext`) but the
124 // component was unmounted while pending under <Suspense>. Without
125 // this guard the effect would become an orphan: not held by any
126 // scope (so it cannot be stopped via the scope chain) yet still
127 // able to subscribe to reactive deps and fire forever.
128 this.flags &= ~EffectFlags.ACTIVE
129 }
130 }
131 }
132
133 pause(): void {
134 this.flags |= EffectFlags.PAUSED

Callers

nothing calls this directly

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected