* Set new collection if `components` are provided, otherwise the * current collection is returned * @param {Component|Component[]|String} [components] Component Definitions or HTML string * @param {Object} [opts={}] Options, same as in `Component.append()` * @returns {Collection|Array<[
(
components?: T,
opts: ResetComponentsOptions = {},
)
| 1161 | * // -> 2 |
| 1162 | */ |
| 1163 | components<T extends ComponentAdd | undefined>( |
| 1164 | components?: T, |
| 1165 | opts: ResetComponentsOptions = {}, |
| 1166 | ): undefined extends T ? Components : Component[] { |
| 1167 | const coll = this.get('components')!; |
| 1168 | |
| 1169 | if (isUndefined(components)) { |
| 1170 | return coll as any; |
| 1171 | } else { |
| 1172 | coll.reset(undefined, opts); |
| 1173 | return (components ? this.append(components, opts) : []) as any; |
| 1174 | } |
| 1175 | } |
| 1176 | |
| 1177 | /** |
| 1178 | * If exists, returns the child component at specific index. |
no test coverage detected