mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-06-09 09:42:26 +00:00
refactor update checking
This commit is contained in:
parent
f45f570730
commit
18f0d454be
1 changed files with 12 additions and 14 deletions
|
|
@ -834,8 +834,7 @@ function registerCoverListener() {
|
||||||
registerCoverListener();
|
registerCoverListener();
|
||||||
|
|
||||||
// Check latest release every 10m
|
// 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")
|
fetch("https://api.github.com/repos/JulienMaille/dribbblish-dynamic-theme/releases/latest")
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|
@ -844,11 +843,10 @@ waitForElement([".main-topBar-container"], ([topBarContainer]) => {
|
||||||
Dribbblish.info.set("dev", isDev ? { tooltip: "Dev build", icon: svgCode } : null);
|
Dribbblish.info.set("dev", isDev ? { tooltip: "Dev build", icon: svgCode } : null);
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(checkForUpdate, 10 * 60 * 1000);
|
setInterval(checkForUpdate, 10 * 60 * 1000);
|
||||||
checkForUpdate();
|
checkForUpdate();
|
||||||
});
|
|
||||||
|
|
||||||
// Show "Offline info"
|
// Show "Offline info"
|
||||||
window.addEventListener("offline", () =>
|
window.addEventListener("offline", () =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue