import { product } from "./product.js"; import { product_container } from "./product_container.js"; export class product_containers { #content; #where; #inserted; constructor(where) { this.#where = where; this.#content = new Array(); this.#inserted = new Array(); } add_list(target) { target.forEach(count => { this.add(count); }); return this; } add(target) { const current = new product_container(target); this.#content.push(current); return this; } clean() { this.#content = new Array(); return this; } update() { this.#hide(); setTimeout(() => { this.#content.forEach(count => { this.#inserted.push(count); count.add(this.#where); }); }, 500); return this; } #hide() { this.#inserted.forEach(count => { if (!this.#content.includes(count)) { count.drop(); } }); this.#inserted = new Array(); return this; } }