export class BaseEntity { constructor() { this.components = new Map(); this.id = 0; } addComponent(component) { let comp = new component(); comp.id = component.id; this.components.set(component.id, comp); } removeComponent(component) { this.components.delete(component.id); } getComponentIDs() { return [...this.components.keys()]; } getComponent(component) { return this.components.get(component.id); } getComponentByID(id) { return this.components.get(id); } }