* Applies one or more mixins to this construct. * * Mixins are applied in order. The list of constructs is captured at the * start of the call, so constructs added by a mixin will not be visited. * Use multiple `with()` calls if subsequent mixins should apply to added * constructs.
(...mixins: IMixin[])
| 481 | * @returns This construct for chaining |
| 482 | */ |
| 483 | public with(...mixins: IMixin[]): IConstruct { |
| 484 | const allConstructs = this.findAll(); |
| 485 | for (const mixin of mixins) { |
| 486 | for (const construct of allConstructs) { |
| 487 | if (mixin.supports(construct)) { |
| 488 | mixin.applyTo(construct); |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | return this.host; |
| 493 | }; |
| 494 | |
| 495 | /** |
| 496 | * Adds a child construct to this node. |