17 lines
617 B
JavaScript
17 lines
617 B
JavaScript
/*
|
|
* Copyright (C) 2026 Mateusz Gruszczyński @linuxiarz.pl
|
|
* Source-Available Code / Dual-Licensed.
|
|
*
|
|
* Free for non-commercial and evaluation use under terms of BSL/GPLv3.
|
|
* Commercial or production use requires a valid paid license.
|
|
* See LICENSE file in repository root for details.
|
|
*/
|
|
|
|
export const CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS = 5;
|
|
|
|
export function reconnectStatus(attempt, networkOnline = true) {
|
|
const normalizedAttempt = Math.max(0, Number(attempt) || 0);
|
|
if (!networkOnline || normalizedAttempt < CONNECTION_ERROR_AFTER_RECONNECT_ATTEMPTS) return "reconnecting";
|
|
return "error";
|
|
}
|