MCPcopy Index your code
hub / github.com/angular/angular / cleanup

Function cleanup

packages/core/src/render3/reactivity/effect.ts:235–251  ·  view source on GitHub ↗
(this: EffectNode)

Source from the content-addressed store, hash-verified

233 },
234
235 cleanup(this: EffectNode): void {
236 if (!this.cleanupFns?.length) {
237 return;
238 }
239 const prevConsumer = setActiveConsumer(null);
240 try {
241 // Attempt to run the cleanup functions. Regardless of failure or success, we consider
242 // cleanup "completed" and clear the list for the next run of the effect. Note that an error
243 // from the cleanup function will still crash the current run of the effect.
244 while (this.cleanupFns.length) {
245 this.cleanupFns.pop()!();
246 }
247 } finally {
248 this.cleanupFns = [];
249 setActiveConsumer(prevConsumer);
250 }
251 },
252 }))();
253
254export const ROOT_EFFECT_NODE: Omit<RootEffectNode, 'fn' | 'scheduler' | 'notifier' | 'injector'> =

Callers

nothing calls this directly

Calls 2

setActiveConsumerFunction · 0.90
popMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…