mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Separate the 'are we connected' timer from the regular tick
This commit is contained in:
@@ -29,22 +29,26 @@ window.router = new SiteRouter();
|
||||
window.bus.connect();
|
||||
window.router.initialRoute();
|
||||
let graphPeriod = localStorage.getItem('graphPeriod');
|
||||
if (!graphPeriod) {
|
||||
graphPeriod = "5m";
|
||||
if (!graphPeriod) {
|
||||
graphPeriod = "5m";
|
||||
localStorage.setItem('graphPeriod', graphPeriod);
|
||||
}
|
||||
window.graphPeriod = graphPeriod;
|
||||
window.changeGraphPeriod = (period: string) => changeGraphPeriod(period);
|
||||
|
||||
// 10 Second interval for refreshing the page
|
||||
window.setInterval(() => {
|
||||
console.log("tick");
|
||||
window.router.ontick();
|
||||
window.bus.updateConnected();
|
||||
let btn = document.getElementById("graphPeriodBtn") as HTMLButtonElement;
|
||||
btn.innerText = window.graphPeriod;
|
||||
}, 10000);
|
||||
|
||||
function changeGraphPeriod(period: string) {
|
||||
// Faster interval for tracking the WSS connection
|
||||
window.setInterval(() => {
|
||||
window.bus.updateConnected();
|
||||
}, 500);
|
||||
|
||||
function changeGraphPeriod(period: string) {
|
||||
window.graphPeriod = period;
|
||||
localStorage.setItem('graphPeriod', period);
|
||||
let btn = document.getElementById("graphPeriodBtn") as HTMLButtonElement;
|
||||
|
||||
Reference in New Issue
Block a user