From 68ecf6c0b33e1348523f7540d1a2603321a915bc Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Sat, 11 Apr 2020 20:09:53 +0200 Subject: WebSockets: add method for retrieving surface manifest in ardour.js --- share/web_surfaces/shared/ardour.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'share') diff --git a/share/web_surfaces/shared/ardour.js b/share/web_surfaces/shared/ardour.js index 99342c650f..4c33a95950 100644 --- a/share/web_surfaces/shared/ardour.js +++ b/share/web_surfaces/shared/ardour.js @@ -42,6 +42,21 @@ export class Ardour { } } + async getSurfaceManifest () { + const response = await fetch('manifest.xml'); + + if (response.status == 200) { + const xmlText = await response.text(); + const xmlDoc = new DOMParser().parseFromString(xmlText, 'text/xml'); + return { + name: xmlDoc.getElementsByTagName('Name')[0].getAttribute('value'), + description: xmlDoc.getElementsByTagName('Description')[0].getAttribute('value') + } + } else { + throw new Error(`HTTP response status ${response.status}`); + } + } + // TO DO - add methods for dealing with messages flowing from/to the WebSockets channel } -- cgit v1.2.3