Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(!WebMidi.enabled){
WebMidi.enable(function(err) {
if (err) { warning("WebMidi couldn't be enabled: " + err) }
else {
out("WedMidi enabled")
//out(WebMidi.inputs)
//out(WebMidi.outputs)
inspect({"WebMidi.inputs": WebMidi.inputs,
"WebMidi.outputs": WebMidi.outputs})
}
})
//eval_and_play_button_id.style.display = "inline-block"
}
else {
Midi.all_notes_off()
WebMidi.disable() //undefines the listeners, maybe other stuff
setTimeout(Midi.init, 1000)
}
}
componentWillUnmount() {
if (this.canAccessMidi) {
for (let input in this.inputs) {
this.inputs[input].removeListener("noteon", "all", this.handleNoteOn);
this.inputs[input].removeListener("noteoff", "all", this.handleNoteOff);
}
webmidi.disable();
}
}