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

Function trigger

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

Source from the content-addressed store, hash-verified

210}
211
212export function trigger(fn: () => void) {
213 const sub: ReactiveNode = {
214 deps: undefined,
215 depsTail: undefined,
216 flags: ReactiveFlags.Watching,
217 };
218 const prevSub = setActiveSub(sub);
219 try {
220 fn();
221 } finally {
222 activeSub = prevSub;
223 sub.flags = ReactiveFlags.None;
224 let link = sub.deps;
225 while (link !== undefined) {
226 const dep = link.dep;
227 link = unlink(link, sub);
228 const subs = dep.subs;
229 if (subs !== undefined) {
230 propagate(subs, !!runDepth);
231 shallowPropagate(subs);
232 }
233 }
234 if (!batchDepth) {
235 flush();
236 }
237 }
238}
239
240function updateComputed(c: ComputedNode): boolean {
241 if (c.flags & HasChildEffect) {

Callers 1

trigger.spec.tsFile · 0.90

Calls 5

setActiveSubFunction · 0.85
unlinkFunction · 0.85
propagateFunction · 0.85
shallowPropagateFunction · 0.85
flushFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…