Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+39
@@ -0,0 +1,39 @@
|
||||
// Web Socket
|
||||
export function webSocketConnect() {
|
||||
var ws = new WebSocket (document.getElementById('connectInput').value);
|
||||
ws.onopen = function () {
|
||||
document.getElementById('connectBtn').classList.replace("btn-outline-danger", "btn-outline-success")
|
||||
servicePortsInformationRequest(ws);
|
||||
}
|
||||
|
||||
ws.onmessage = function(msg) {
|
||||
console.log(JSON.parse(msg.data).data)
|
||||
|
||||
var exercises = new Map;
|
||||
var object = (JSON.parse(msg.data)).data;
|
||||
object.forEach((item, index, array) => {
|
||||
if (item.exercisesId != 0) {
|
||||
console.log (item.exerciseId)
|
||||
exercises.set(item.exerciseId, item);
|
||||
document.getElementById('exerciseSelect').innerHTML += `<option value=${item.exerciseId}>Exercise ${item.exerciseId}</option>`
|
||||
}
|
||||
console.log(exercises)
|
||||
})
|
||||
|
||||
document.getElementById('exerciseSelect').disabled = false;
|
||||
document.getElementById('exerciseBtn').disabled = false;
|
||||
}
|
||||
|
||||
ws.onclose = function() {
|
||||
document.getElementById('connectBtn').classList.replace("btn-outline-success", "btn-outline-danger")
|
||||
}
|
||||
}
|
||||
|
||||
// Request
|
||||
function servicePortsInformationRequest(ws) {
|
||||
|
||||
ws.send(JSON.stringify({
|
||||
type: "servicePortsInformationRequest",
|
||||
uuid: "UUID"
|
||||
}));
|
||||
}
|
||||
Reference in new issue
Block a user