(fn: () => void)
| 438 | } |
| 439 | |
| 440 | export function effect(fn: () => void): () => void { |
| 441 | const e: EffectNode = { |
| 442 | fn, |
| 443 | subs: undefined, |
| 444 | subsTail: undefined, |
| 445 | deps: undefined, |
| 446 | depsTail: undefined, |
| 447 | flags: ReactiveFlags.Watching | ReactiveFlags.RecursedCheck |
| 448 | }; |
| 449 | const prevSub = setActiveSub(e); |
| 450 | if (prevSub !== undefined) { |
| 451 | link(e, prevSub, 0); |
| 452 | } |
| 453 | try { |
| 454 | e.fn(); |
| 455 | } finally { |
| 456 | activeSub = prevSub; |
| 457 | e.flags &= ~ReactiveFlags.RecursedCheck; |
| 458 | } |
| 459 | return effectOper.bind(e); |
| 460 | } |
| 461 | |
| 462 | export function effectScope(fn: () => void): () => void { |
| 463 | const e: ReactiveNode = { |
nothing calls this directly
no test coverage detected