Conditional attaches a runtime condition to the component. The condition is evaluated before the component is loaded into the container.
(cond Condition)
| 70 | // Conditional attaches a runtime condition to the component. |
| 71 | // The condition is evaluated before the component is loaded into the container. |
| 72 | func (r *Registration) Conditional(cond Condition) *Registration { |
| 73 | r.component.attachCondition(cond) |
| 74 | return r |
| 75 | } |
| 76 | |
| 77 | // Register registers a new component using the given constructor function and optional definition options. |
| 78 | // It panics if the component name already exists or if definition creation fails. |