MCPcopy
hub / github.com/stackblitz/alien-signals / effectScope

Function effectScope

src/index.ts:191–210  ·  view source on GitHub ↗
(fn: () => void)

Source from the content-addressed store, hash-verified

189}
190
191export function effectScope(fn: () => void): () => void {
192 const e: EffectScopeNode = {
193 deps: undefined,
194 depsTail: undefined,
195 subs: undefined,
196 subsTail: undefined,
197 flags: ReactiveFlags.Mutable,
198 };
199 const prevSub = setActiveSub(e);
200 if (prevSub !== undefined) {
201 link(e, prevSub, 0);
202 prevSub.flags |= HasChildEffect;
203 }
204 try {
205 fn();
206 } finally {
207 activeSub = prevSub;
208 }
209 return effectScopeOper.bind(e);
210}
211
212export function trigger(fn: () => void) {
213 const sub: ReactiveNode = {

Callers 2

runFunction · 0.90

Calls 2

setActiveSubFunction · 0.85
linkFunction · 0.85

Tested by 1

runFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…