import {JRSection} from "./JRSection"; import {JRBand} from "./JRBand"; import {IObservableArray, observable} from "mobx"; export class JRDesignSection implements JRSection { private _bands:IObservableArray = observable([]); addBand(band:JRBand):void { this._bands.push(band); } removeBand(band:JRBand):void { const index = this._bands.indexOf(band); if (index > -1) { this._bands.splice(index, 1); } } constructor(...bands) { if (bands) { bands.forEach(item => { if (typeof(item.forEach) === 'function') { item.forEach(band => this._bands.push(band), this); } else { this._bands.push(item); } }, this); } } getBands():JRBand[] { return this._bands; } }