(eventName: string, listener: (event: T) => unknown)
| 179 | * @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation) |
| 180 | */ |
| 181 | export function outputBinding<T>(eventName: string, listener: (event: T) => unknown): Binding { |
| 182 | // Note: ideally we would use a class here, but it seems like they |
| 183 | // don't get tree shaken when constructed by a function like this. |
| 184 | const binding: BindingInternal = { |
| 185 | [BINDING]: OUTPUT_BINDING_METADATA, |
| 186 | create: () => { |
| 187 | const lView = getLView<{} | null>(); |
| 188 | const tNode = getCurrentTNode()!; |
| 189 | const tView = lView[TVIEW]; |
| 190 | const targetDef = tView.directiveRegistry![binding.targetIdx!]; |
| 191 | createOutputListener(tNode, lView, listener, targetDef, eventName); |
| 192 | }, |
| 193 | }; |
| 194 | |
| 195 | return binding; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Creates a two-way binding. |
no test coverage detected
searching dependent graphs…