@bscotch/stitch
Version:
Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.
23 lines • 847 B
JavaScript
import { hydrateArray } from '../hydrate.js';
import { Gms2ComponentArrayBase } from './Gms2ComponentArrayBase.js';
export class Gms2ComponentArray extends Gms2ComponentArrayBase {
componentClass;
constructor(data, componentClass) {
super();
this.componentClass = componentClass;
// Remove duplicates
this.items = hydrateArray(this.uniqueYypDataEntries(data), this.componentClass);
}
// @ts-expect-error Typescript does not like the use of a different function signature in overrides
addNew(data, options) {
const newComponent = new this.componentClass(data);
if (options?.prepend) {
this.prepend(newComponent);
}
else {
this.push(newComponent);
}
return newComponent;
}
}
//# sourceMappingURL=Gms2ComponentArray.js.map