MCPcopy
hub / github.com/angular/angular / BoundEvent

Class BoundEvent

packages/compiler/src/render3/r3_ast.ts:121–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121export class BoundEvent implements Node {
122 constructor(
123 public name: string,
124 public type: ParsedEventType,
125 public handler: AST,
126 public target: string | null,
127 public phase: string | null,
128 public sourceSpan: ParseSourceSpan,
129 public handlerSpan: ParseSourceSpan,
130 readonly keySpan: ParseSourceSpan,
131 ) {}
132
133 static fromParsedEvent(event: ParsedEvent) {
134 const target: string | null =
135 event.type === ParsedEventType.Regular ? event.targetOrPhase : null;
136 const phase: string | null =
137 event.type === ParsedEventType.LegacyAnimation ? event.targetOrPhase : null;
138 if (event.keySpan === undefined) {
139 throw new Error(
140 `Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`,
141 );
142 }
143 return new BoundEvent(
144 event.name,
145 event.type,
146 event.handler,
147 target,
148 phase,
149 event.sourceSpan,
150 event.handlerSpan,
151 event.keySpan,
152 );
153 }
154
155 visit<Result>(visitor: Visitor<Result>): Result {
156 return visitor.visitBoundEvent(this);
157 }
158}
159
160export class Element implements Node {
161 constructor(

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…