Your IP : 216.73.216.95


Current Path : /var/www/ooareogundevinitiative/wp-content/plugins/foogallery/gutenberg/src/block/edit/
Upload File :
Current File : /var/www/ooareogundevinitiative/wp-content/plugins/foogallery/gutenberg/src/block/edit/rendered.js

const rendered = [];
export default class FooGalleryEditRendered {
	static get array(){
		return rendered;
	}

	static add( id, clientId ){
		let index = rendered.findIndex(r => r.id === id);
		if (index === -1){
			rendered.push({ id, clientId });
			return true;
		}
		return false;
	}

	static remove( clientId ){
		let index = rendered.findIndex(r => r.clientId === clientId);
		if (index !== -1){
			rendered.splice(index, 1);
			return true;
		}
		return index === -1 || false;
	}

	static update( id, clientId ){
		if (this.remove( clientId )){
			return this.add( id, clientId );
		}
		return false;
	}

	static ids(){
		return rendered.map(r => r.id);
	}

	static contains( id, clientId ){
		return rendered.findIndex(r => r.id === id && r.clientId !== clientId) !== -1;
	}
}