Make stop_refresh an object that can be modified from another module

This commit is contained in:
nemunaire 2023-03-20 14:44:23 +01:00
parent ef1eafb789
commit 38c0a5ceee
7 changed files with 8 additions and 7 deletions

View file

@ -1 +1 @@
export let stop_refresh = false;
export let stop_refresh = { state: false };

View file

@ -27,7 +27,7 @@ function createIssuesStore() {
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 32000;
}
if (stop_refresh) {
if (stop_refresh.state) {
return;
}
refresh_interval_issues = setInterval(refreshFunc, interval);

View file

@ -46,7 +46,7 @@ function createMyStore() {
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 24000;
}
if (stop_refresh) {
if (stop_refresh.state) {
return;
}
refresh_interval_my = setInterval(refreshFunc, interval);

View file

@ -47,7 +47,7 @@ function createSettingsStore() {
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 32000;
}
if (stop_refresh) {
if (stop_refresh.state) {
return;
}
refresh_interval_settings = setInterval(refreshFunc, interval);

View file

@ -25,7 +25,7 @@ function createTeamsStore() {
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 32000;
}
if (stop_refresh) {
if (stop_refresh.state) {
return;
}
refresh_interval_teams = setInterval(refreshFunc, interval);

View file

@ -25,7 +25,7 @@ function createThemesStore() {
if (interval === null) {
interval = Math.floor(Math.random() * 24000) + 32000;
}
if (stop_refresh) {
if (stop_refresh.state) {
return;
}
refresh_interval_themes = setInterval(refreshFunc, interval);

View file

@ -1,4 +1,5 @@
import { challengeInfo } from '$lib/stores/challengeinfo.js';
import { stop_refresh } from '$lib/stores/common';
import { issuesStore } from '$lib/stores/issues.js';
import { my } from '$lib/stores/my.js';
import { teamsStore } from '$lib/stores/teams.js';
@ -14,7 +15,7 @@ export async function load() {
teamsStore.refresh();
my.refresh((my) => {
if (my && my.team_id === 0) {
stop_refresh = true;
stop_refresh.state = true;
}
});
issuesStore.refresh();