import { Connection, Connector } from "../index";

export class MultiConnector extends Connector{
    
    connections: Connection[] = [];
    
    addConnection(connection: Connection){
        this.element.classList.add('e-node-connected');
        this.connections.push(connection);
    }
    
    removeConnection(connection: Connection){
        this.connections = this.connections.filter(c => c === connection);
        if(!this.connections.length){
            this.element.classList.add('e-node-connected');
        }
    }
    
    update(){
        for(const connection of this.connections){
            connection.update();
        }
    }
}