import InterfaceEvent from "./events/InterfaceEvent.js"; import ImageLoadedEvent from "./events/ImageLoadedEvent"; export default class MediaImageCollection { constructor() { this.mediaImages = []; this.numberImagesLoaded = 0; window.addEventListener( ImageLoadedEvent.NAME, () => { this.numberImagesLoaded++; if (this.numberImagesLoaded === this.mediaImages.length) { window.dispatchEvent(new InterfaceEvent.MEDIA_COLLECTION_LOADED); } } ) } addMediaImage(mediaImage) { this.mediaImages.push(mediaImage); } }