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

Class AfterRenderSequence

packages/core/src/render3/after_render/manager.ts:184–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182];
183
184export class AfterRenderSequence implements AfterRenderRef {
185 /**
186 * Whether this sequence errored or was destroyed during this execution, and hooks should no
187 * longer run for it.
188 */
189 erroredOrDestroyed: boolean = false;
190
191 /**
192 * The value returned by the last hook execution (if any), ready to be pipelined into the next
193 * one.
194 */
195 pipelinedValue: unknown = undefined;
196
197 private unregisterOnDestroy: (() => void) | undefined;
198
199 constructor(
200 readonly impl: AfterRenderImpl,
201 readonly hooks: AfterRenderHooks,
202 readonly view: LView | undefined,
203 public once: boolean,
204 destroyRef: DestroyRef | null,
205 public snapshot: TracingSnapshot | null = null,
206 ) {
207 this.unregisterOnDestroy = destroyRef?.onDestroy(() => this.destroy());
208 }
209
210 afterRun(): void {
211 this.erroredOrDestroyed = false;
212 this.pipelinedValue = undefined;
213
214 // Clear the tracing snapshot after the initial run. This snapshot only
215 // associates the initial run of the hook with the context that created it.
216 // Follow-up runs are independent of that initial context and have different
217 // triggers.
218 this.snapshot?.dispose();
219 this.snapshot = null;
220 }
221
222 destroy(): void {
223 this.impl.unregister(this);
224 this.unregisterOnDestroy?.();
225 const scheduled = this.view?.[AFTER_RENDER_SEQUENCES_TO_ADD];
226 if (scheduled) {
227 this.view[AFTER_RENDER_SEQUENCES_TO_ADD] = scheduled.filter((s) => s !== this);
228 }
229 }
230}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…