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

Method execute

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

* Run the sequence of phases of hooks, once through. As a result of executing some hooks, more * might be scheduled.

()

Source from the content-addressed store, hash-verified

69 * might be scheduled.
70 */
71 execute(): void {
72 const hasSequencesToExecute = this.sequences.size > 0;
73
74 if (hasSequencesToExecute) {
75 profiler(ProfilerEvent.AfterRenderHooksStart);
76 }
77
78 this.executing = true;
79 for (const phase of AFTER_RENDER_PHASES) {
80 for (const sequence of this.sequences) {
81 if (sequence.erroredOrDestroyed || !sequence.hooks[phase]) {
82 continue;
83 }
84
85 try {
86 sequence.pipelinedValue = this.ngZone.runOutsideAngular(() =>
87 this.maybeTrace(() => {
88 const hookFn = sequence.hooks[phase]!;
89 const value = hookFn(sequence.pipelinedValue);
90 return value;
91 }, sequence.snapshot),
92 );
93 } catch (err) {
94 sequence.erroredOrDestroyed = true;
95 this.errorHandler?.handleError(err);
96 }
97 }
98 }
99 this.executing = false;
100
101 // Cleanup step to reset sequence state and also collect one-shot sequences for removal.
102 for (const sequence of this.sequences) {
103 sequence.afterRun();
104 if (sequence.once) {
105 this.sequences.delete(sequence);
106 // Destroy the sequence so its on destroy callbacks can be cleaned up
107 // immediately, instead of waiting until the injector is destroyed.
108 sequence.destroy();
109 }
110 }
111
112 for (const sequence of this.deferredRegistrations) {
113 this.sequences.add(sequence);
114 }
115 if (this.deferredRegistrations.size > 0) {
116 this.scheduler.notify(NotificationSource.RenderHook);
117 }
118 this.deferredRegistrations.clear();
119
120 if (hasSequencesToExecute) {
121 profiler(ProfilerEvent.AfterRenderHooksEnd);
122 }
123 }
124
125 register(sequence: AfterRenderSequence): void {
126 const {view} = sequence;

Callers

nothing calls this directly

Calls 10

maybeTraceMethod · 0.95
profilerFunction · 0.90
handleErrorMethod · 0.65
destroyMethod · 0.65
addMethod · 0.65
notifyMethod · 0.65
runOutsideAngularMethod · 0.45
afterRunMethod · 0.45
deleteMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected