2019-11-01 18:30:50 +01:00
|
|
|
|
|
|
|
// DOM STUFF ///////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-01-13 16:13:42 +01:00
|
|
|
var app = new Vue({
|
|
|
|
el: '#wrapper',
|
|
|
|
data: {
|
|
|
|
message: 'Hello Vue!',
|
|
|
|
hits: {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// watch: {
|
|
|
|
// hits: {
|
|
|
|
// deep: true
|
|
|
|
// }
|
|
|
|
// }
|
2019-11-01 18:30:50 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// SOCKET STUFF ////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
let ws = new ReconnectingWebSocket('ws://localhost:8888/status/ws')
|
|
|
|
|
|
|
|
|
|
|
|
ws.addEventListener('open', () => {
|
|
|
|
// ws.send('hi server')
|
|
|
|
})
|
|
|
|
|
|
|
|
ws.addEventListener('message', (event) => {
|
|
|
|
console.log('message: ' + event.data)
|
|
|
|
|
2020-01-13 16:13:42 +01:00
|
|
|
let hits = JSON.parse(event.data)
|
|
|
|
let a = {};
|
|
|
|
for(let hitid in app.hits) {
|
|
|
|
a[hitid] = app.hits[hitid];
|
2019-11-01 18:30:50 +01:00
|
|
|
}
|
2020-01-13 16:13:42 +01:00
|
|
|
for(let hit of hits){
|
|
|
|
a[hit.id] = hit;
|
2019-11-01 18:56:00 +01:00
|
|
|
}
|
2020-01-13 16:13:42 +01:00
|
|
|
app.hits = a;
|
2019-11-01 18:30:50 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// ANIMATION STUFF /////////////////////////////////////////////////////////////
|
2020-01-13 16:13:42 +01:00
|
|
|
//
|
|
|
|
//function update(step){
|
|
|
|
//
|
|
|
|
// if(!hit_finished) elapsed_time = `${new Date((Date.now() - request_time)).format('MM"m "ss"s"')}`
|
|
|
|
// if(hit_started){
|
|
|
|
// divs['elapsed_time'].innerHTML = elapsed_time
|
|
|
|
// }else{
|
|
|
|
// divs['elapsed_time'].innerHTML = `—`
|
|
|
|
// }
|
|
|
|
//}
|