WebSockets: add method for retrieving surface manifest in ardour.js

This commit is contained in:
Luciano Iam 2020-04-11 20:09:53 +02:00 committed by Robin Gareus
parent 3d8e430324
commit 68ecf6c0b3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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
}