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