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

Function ingestHostEvent

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

Source from the content-addressed store, hash-verified

245}
246
247export function ingestHostEvent(job: HostBindingCompilationJob, event: e.ParsedEvent) {
248 let eventBinding: ir.CreateOp;
249 if (event.type === e.ParsedEventType.Animation) {
250 eventBinding = ir.createAnimationListenerOp(
251 job.root.xref,
252 new ir.SlotHandle(),
253 event.name,
254 null,
255 makeListenerHandlerOps(job.root, event.handler, event.handlerSpan),
256 event.name.endsWith('enter') ? ir.AnimationKind.ENTER : ir.AnimationKind.LEAVE,
257 event.targetOrPhase,
258 true,
259 event.sourceSpan,
260 );
261 } else {
262 const [phase, target] =
263 event.type !== e.ParsedEventType.LegacyAnimation
264 ? [null, event.targetOrPhase]
265 : [event.targetOrPhase, null];
266
267 eventBinding = ir.createListenerOp(
268 job.root.xref,
269 new ir.SlotHandle(),
270 event.name,
271 null,
272 makeListenerHandlerOps(job.root, event.handler, event.handlerSpan),
273 phase,
274 target,
275 true,
276 event.sourceSpan,
277 );
278 }
279 job.root.create.push(eventBinding);
280}
281
282/**
283 * 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