From 26ec2dcaea4a334ac3a8683d6ed5be83ea57fd5b Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Wed, 27 Nov 2024 15:38:11 -0800 Subject: [PATCH 1/2] Move remaining examples to explainer, and modernize and fix errors in examples --- explainer.md | 35 +++++++++++++++++++++++++++++++---- index.html | 38 +++----------------------------------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/explainer.md b/explainer.md index 48abf97..11d5b58 100644 --- a/explainer.md +++ b/explainer.md @@ -62,6 +62,30 @@ function listInputsAndOutputs( midiAccess ) { } ``` +### Adding inputs and outputs to a box +for (let input of inputs.values()) { + let opt = document.createElement("option"); + opt.text = input.name; + document.getElementById("inputportselector").add(opt); +} + +// to tell how many entries there are: +let numberOfMIDIOutputs = outputs.size; + +// add each of the ports to a box +### Adding inputs and outputs to select boxes ```js // to tell how many entries there are: