| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 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;
- }
- }
|