diff options
author | Luciano Iam <lucianito@gmail.com> | 2020-04-11 20:09:53 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-04-11 22:30:42 +0200 |
commit | 68ecf6c0b33e1348523f7540d1a2603321a915bc (patch) | |
tree | e5ce46a7064887a4c99cd158e3bfb8a0ec3ae02d /share/web_surfaces | |
parent | 3d8e430324fc0a858b28f16e26e49727c97ba930 (diff) |
WebSockets: add method for retrieving surface manifest in ardour.js
Diffstat (limited to 'share/web_surfaces')
-rw-r--r-- | share/web_surfaces/shared/ardour.js | 15 |
1 files changed, 15 insertions, 0 deletions
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 } |