MCPcopy Create free account
hub / github.com/angular/angular / ingestHostEvent

Function ingestHostEvent

packages/compiler/src/template/pipeline/src/ingest.ts:203–236  ·  view source on GitHub ↗
(job: HostBindingCompilationJob, event: e.ParsedEvent)

Source from the content-addressed store, hash-verified

201}
202
203export function ingestHostEvent(job: HostBindingCompilationJob, event: e.ParsedEvent) {
204 let eventBinding: ir.CreateOp;
205 if (event.type === e.ParsedEventType.Animation) {
206 eventBinding = ir.createAnimationListenerOp(
207 job.root.xref,
208 new ir.SlotHandle(),
209 event.name,
210 null,
211 makeListenerHandlerOps(job.root, event.handler, event.handlerSpan),
212 event.name.endsWith('enter') ? ir.AnimationKind.ENTER : ir.AnimationKind.LEAVE,
213 event.targetOrPhase,
214 true,
215 event.sourceSpan,
216 );
217 } else {
218 const [phase, target] =
219 event.type !== e.ParsedEventType.LegacyAnimation
220 ? [null, event.targetOrPhase]
221 : [event.targetOrPhase, null];
222
223 eventBinding = ir.createListenerOp(
224 job.root.xref,
225 new ir.SlotHandle(),
226 event.name,
227 null,
228 makeListenerHandlerOps(job.root, event.handler, event.handlerSpan),
229 phase,
230 target,
231 true,
232 event.sourceSpan,
233 );
234 }
235 job.root.create.push(eventBinding);
236}
237
238/**
239 * Ingest the nodes of a template AST into the given `ViewCompilation`.

Callers 1

ingestHostBindingFunction · 0.85

Calls 2

makeListenerHandlerOpsFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected