refactor update checking

This commit is contained in:
Send_Nukez 2021-11-17 23:30:00 +01:00
parent f45f570730
commit 18f0d454be

View file

@ -834,8 +834,7 @@ function registerCoverListener() {
registerCoverListener();
// Check latest release every 10m
waitForElement([".main-topBar-container"], ([topBarContainer]) => {
function checkForUpdate() {
function checkForUpdate() {
fetch("https://api.github.com/repos/JulienMaille/dribbblish-dynamic-theme/releases/latest")
.then((response) => response.json())
.then((data) => {
@ -844,11 +843,10 @@ waitForElement([".main-topBar-container"], ([topBarContainer]) => {
Dribbblish.info.set("dev", isDev ? { tooltip: "Dev build", icon: svgCode } : null);
})
.catch(console.error);
}
}
setInterval(checkForUpdate, 10 * 60 * 1000);
checkForUpdate();
});
setInterval(checkForUpdate, 10 * 60 * 1000);
checkForUpdate();
// Show "Offline info"
window.addEventListener("offline", () =>