Skip to content

Commit

Permalink
Fix bug when listing midi devices
Browse files Browse the repository at this point in the history
Was only displaying one device.

Credit to Husker for finding this one!
https://op-forums.com/t/op-z-tetris-for-web-browser-midi-tetris/18872/2?u=nbw
  • Loading branch information
nbw committed Dec 8, 2020
1 parent d350e8d commit 0eb3326
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -298,8 +298,8 @@ const midiConnect = (target, handler) => {
setTimeout( () => {
if (midi.devices.length > 0) {
const list = document.getElementById("devices");
const item = document.createElement('li');
for (let i = 0; i < midi.devices.length; i++) {
const item = document.createElement('li');
item.innerHTML = midi.devices[i].name;
item.setAttribute('data-device', i);
item.setAttribute('data-target', "5");
Expand Down
2 changes: 1 addition & 1 deletion src/script.js
Expand Up @@ -343,9 +343,9 @@ var midiConnect = function midiConnect(target, handler) {
setTimeout(function () {
if (midi.devices.length > 0) {
var list = document.getElementById("devices");
var item = document.createElement('li');

for (var i = 0; i < midi.devices.length; i++) {
var item = document.createElement('li');
item.innerHTML = midi.devices[i].name;
item.setAttribute('data-device', i);
item.setAttribute('data-target', "5");
Expand Down

0 comments on commit 0eb3326

Please sign in to comment.