export class ImageCollector { private images = new Set < string > ( ) ; private isCollecting = false ; private static instance : ImageCollector ; private constructor ( ) { } public static getInstance ( ) { if ( ! ImageCollector . instance ) { ImageCollector . instance = new ImageCollector ( ) ; } return ImageCollector . instance ; } public reset ( ) { this . images . clear ( ) ; } public addImage ( filePath ) { this . images . add ( filePath ) ; } public getAll ( ) { return Array . of ( ... this . images ) ; } public enable ( ) { this . isCollecting = true ; } public disable ( ) { this . isCollecting = false ; } public shouldCollect ( ) { return this . isCollecting ; } }