add WebSocket reconnection logic

This commit is contained in:
Nick Krecklow
2020-05-05 17:17:12 -05:00
parent ca9e127e3e
commit 438a72724b
3 changed files with 202 additions and 138 deletions

View File

@ -1,4 +1,5 @@
import { ServerRegistry } from './servers'
import { SocketManager } from './socket'
import { SortController } from './sort'
import { GraphDisplayManager } from './graph'
import { MojangUpdater } from './mojang'
@ -13,6 +14,7 @@ export class App {
this.tooltip = new Tooltip()
this.caption = new Caption()
this.serverRegistry = new ServerRegistry(this)
this.socketManager = new SocketManager(this)
this.sortController = new SortController(this)
this.graphDisplayManager = new GraphDisplayManager(this)
this.mojangUpdater = new MojangUpdater()
@ -22,6 +24,11 @@ export class App {
this._taskIds = []
}
// Called once the DOM is ready and the app can begin setup
init () {
this.socketManager.createWebSocket()
}
setPageReady (isReady) {
document.getElementById('push').style.display = isReady ? 'block' : 'none'
document.getElementById('footer').style.display = isReady ? 'block' : 'none'
@ -60,6 +67,7 @@ export class App {
// Reset individual tracker elements to flush any held data
this.serverRegistry.reset()
this.socketManager.reset()
this.sortController.reset()
this.graphDisplayManager.reset()
this.mojangUpdater.reset()