2019-11-01 17:30:50 +00:00
|
|
|
|
|
|
|
// DOM STUFF ///////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-01-13 15:13:42 +00:00
|
|
|
var app = new Vue({
|
|
|
|
el: '#wrapper',
|
|
|
|
data: {
|
|
|
|
message: 'Hello Vue!',
|
|
|
|
hits: {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// watch: {
|
|
|
|
// hits: {
|
|
|
|
// deep: true
|
|
|
|
// }
|
|
|
|
// }
|
2019-11-01 17:30:50 +00: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 15:13:42 +00:00
|
|
|
let hits = JSON.parse(event.data)
|
|
|
|
let a = {};
|
|
|
|
for(let hitid in app.hits) {
|
|
|
|
a[hitid] = app.hits[hitid];
|
2019-11-01 17:30:50 +00:00
|
|
|
}
|
2020-01-13 15:13:42 +00:00
|
|
|
for(let hit of hits){
|
|
|
|
a[hit.id] = hit;
|
2019-11-01 17:56:00 +00:00
|
|
|
}
|
2020-01-13 15:13:42 +00:00
|
|
|
app.hits = a;
|
2019-11-01 17:30:50 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// ANIMATION STUFF /////////////////////////////////////////////////////////////
|
2020-01-13 15:13:42 +00: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 = `—`
|
|
|
|
// }
|
|
|
|
//}
|