DataTools3/elements/Concatinator.js

22 lines
548 B
JavaScript

class Concatinator extends Box {
constructor() {
super("Concatinator");
this.inputs.push(new Connector(Connector.INPUT, "any", ""));
this.inputs.push(new Connector(Connector.INPUT, "any", ""));
this.outputs.push(new Connector(Connector.OUTPUT, "string", ""));
for (let input of this.inputs) {
input.addListener((d) => {
let concatinated = "";
for (let input2 of this.inputs) {
concatinated = concatinated + input2.cache;
}
for (let output of this.outputs) {
output.send(concatinated);
}
})
}
}
}