(publicName: string, value: () => unknown)
| 131 | * @see [Binding inputs, outputs and setting host directives at creation](guide/components/programmatic-rendering#binding-inputs-outputs-and-setting-host-directives-at-creation) |
| 132 | */ |
| 133 | export function inputBinding(publicName: string, value: () => unknown): Binding { |
| 134 | if (publicName === 'formField') { |
| 135 | const binding: BindingInternal = { |
| 136 | [BINDING]: INPUT_BINDING_METADATA, |
| 137 | create: () => { |
| 138 | controlCreateInternal(); |
| 139 | }, |
| 140 | update: () => { |
| 141 | // Update the [formField] input binding, regardless of whether this targets a 'FormField' directive. |
| 142 | inputBindingUpdate(binding.targetIdx!, publicName, value()); |
| 143 | controlUpdateInternal(); |
| 144 | }, |
| 145 | }; |
| 146 | return binding; |
| 147 | } |
| 148 | |
| 149 | // Note: ideally we would use a class here, but it seems like they |
| 150 | // don't get tree shaken when constructed by a function like this. |
| 151 | const binding: BindingInternal = { |
| 152 | [BINDING]: INPUT_BINDING_METADATA, |
| 153 | update: () => inputBindingUpdate(binding.targetIdx!, publicName, value()), |
| 154 | }; |
| 155 | |
| 156 | return binding; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Creates an output binding. |
no test coverage detected
searching dependent graphs…