From 0d1eb03db4d0aa51aef2be8fa3c68dc89d7088ae Mon Sep 17 00:00:00 2001 From: Sam Tarakajian Date: Tue, 31 Jan 2023 11:43:28 -0500 Subject: [PATCH] Revert "Revert "Update outport attaching code to use the latest API"" This reverts commit 9b3ea007efb9bc18ac74fce091ec24587820f964. --- js/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 03836e1..70e3f72 100644 --- a/js/app.js +++ b/js/app.js @@ -248,7 +248,7 @@ function makeInportForm(device) { } function attachOutports(device) { - const outports = device.messages.filter(message => message.type === RNBO.MessagePortType.Outport); + const outports = device.outports; if (outports.length < 1) { document.getElementById("rnbo-console").removeChild(document.getElementById("rnbo-console-div")); return; @@ -257,6 +257,9 @@ function attachOutports(device) { document.getElementById("rnbo-console").removeChild(document.getElementById("no-outports-label")); device.messageEvent.subscribe((ev) => { + // Ignore message events that don't belong to an outport + if (outports.findIndex(elt => elt.tag === ev.tag) < 0) return; + // Message events have a tag as well as a payload console.log(`${ev.tag}: ${ev.payload}`);