djipco / webmidi

Tame the Web MIDI API. Send and receive MIDI messages with ease. Control instruments with user-friendly functions (playNote, sendPitchBend, etc.). React to MIDI input with simple event listeners (noteon, pitchbend, controlchange, etc.).
Apache License 2.0
1.54k stars 116 forks source link

Refresh input devices when new device is plugin #256

Closed elmcapp closed 2 years ago

elmcapp commented 2 years ago

Is there a way to get a list of new midi devices when a new device is plugin. Currently I can only get a list of new midi devices when I run the following function. However I like to know if there is a listener or a way allow new midi device to show without running the function every time a new device is connect. something like a hot load

// Inputs
  WebMidi.inputs.forEach(input => console.log(input.manufacturer, input.name));