ground-dashboard/ground/dashboard/static/js/main.js

11 lines
300 B
JavaScript
Raw Normal View History

(() => {
let data = []
const dashboard = new Dashboard(document.getElementById('main'))
dashboard.attach()
const webSocket = new WebSocket(`ws://${window.location.host}/api/data`)
webSocket.onmessage = (e) => {
data = data.concat(JSON.parse(e.data))
dashboard.update(data)
}
})()