(untested) refetch goodies on an interval

This commit is contained in:
Ash Lea 2018-04-22 11:59:10 -04:00 committed by GitHub
parent b5f33ede39
commit 0cd80b7f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -23,10 +23,16 @@
users: {}
};
// fetch goodies.json
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => __goodies = r);
function fetchGoodies() {
// fetch goodies.json
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => __goodies = r);
}
// Fetch goodies now and every half hour
fetchGoodies();
setInterval(fetchGoodies, 1800000);
// early init payload
document.addEventListener('ep-prepared', () => {
@ -107,4 +113,4 @@
});
})();
})();