non fonctionnel, bug adafruit

This commit is contained in:
xperignon
2020-05-22 15:45:36 +02:00
parent 019a3c5d30
commit 52083c5742
1537 changed files with 1363807 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
document.addEventListener('DOMContentLoaded', () => {
const ws = new WebSocket(`ws://${location.host}/ws`);
ws.onmessage = (e) => {
if (typeof e.data === 'string') {
let node = document.createElement('li');
let text = document.createTextNode(e.data);
node.appendChild(text);
document.getElementById('serial-output').appendChild(node);
}
};
document.getElementById('serial-command-form').addEventListener('submit', (e) => {
e.preventDefault();
let value = document.getElementById('serial-command').value.trim();
if (!value) return;
ws.send(`${value}\n`);
document.getElementById('serial-command').value = '';
});
});