"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusUpdater = void 0;
class StatusUpdater {
    constructor(socket) {
        this.socket = socket;
        this.connectionText = 'never-connected';
        this.testText = 'loading';
        this.pingText = '';
        socket.on('connect', () => {
            this.updateConnectionStatus('connected');
        });
        socket.on('disconnect', () => {
            this.updateConnectionStatus('disconnected');
        });
        socket.on('reconnecting', (sec) => {
            this.updateConnectionStatus('reconnecting in ' + sec + ' seconds');
        });
        socket.on('reconnect', () => {
            this.updateConnectionStatus('reconnected');
        });
        socket.on('reconnect_failed', () => {
            this.updateConnectionStatus('reconnect_failed');
        });
        socket.on('info', () => this.updateBrowsersInfo([]));
        socket.on('disconnect', () => {
            this.updateBrowsersInfo([]);
        });
        socket.on('ping', () => {
            this.updatePingStatus('ping...');
        });
        socket.on('pong', (latency) => {
            this.updatePingStatus('ping ' + latency + 'ms');
        });
    }
    updateBrowsersInfo(browsers) { }
    updateBanner() { }
    updateConnectionStatus(connectionStatus) {
        this.connectionText = connectionStatus || this.connectionText;
        this.updateBanner();
    }
    updateTestStatus(testStatus) {
        this.testText = testStatus || this.testText;
        this.updateBanner();
    }
    updatePingStatus(pingStatus) {
        this.pingText = pingStatus || this.pingText;
        this.updateBanner();
    }
}
exports.StatusUpdater = StatusUpdater;
//# sourceMappingURL=updater.js.map