loading-bar
loading-bar copied to clipboard
Very unresponsive/glitchy when updating every second
I'm receiving value updates from a websocket connection every second and the bar does not update consistently at all:
https://user-images.githubusercontent.com/75134774/154153733-ce2bc939-12d8-4bb1-a02e-212bfe079eaa.mp4
And when I disable animations, the value is completely incorrect:
https://user-images.githubusercontent.com/75134774/154153924-a840876d-1942-4d7a-a2ff-f61264765004.mp4
Relevant code:
var thingy = new ldBar("#thing");
ws = new WebSocket("ws://localhost:4000/ws/metrics")
ws.onopen = function() {
console.log('WS Connected')
}
ws.onmessage = function(evt) {
console.log('WS Message:',evt.data)
thingy.set(evt.data)
}
<div
id="thing"
data-preset="fan"
class="ldBar label-center"
data-value="0"
data-min="0"
data-max="1000"
></div>