nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions

View File

@@ -15,19 +15,17 @@ var socket = function initSocket(url, handlers) {
sock.onclose = function onclose() {
if (retries === 0) {
handlers.close();
}
} // Try to reconnect.
// Try to reconnect.
sock = null;
// After 10 retries stop trying, to prevent logspam.
sock = null; // After 10 retries stop trying, to prevent logspam.
if (retries <= 10) {
// Exponentially increase timeout to reconnect.
// Respectfully copied from the package `got`.
// eslint-disable-next-line no-mixed-operators, no-restricted-properties
var retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
retries += 1;
setTimeout(function () {
socket(url, handlers);
}, retryInMs);
@@ -37,6 +35,7 @@ var socket = function initSocket(url, handlers) {
sock.onmessage = function onmessage(e) {
// This assumes that all data sent via the websocket is JSON.
var msg = JSON.parse(e.data);
if (handlers[msg.type]) {
handlers[msg.type](msg.data);
}