| 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 |