declare goodies in window

This commit is contained in:
Astra 2018-05-08 00:55:47 -04:00
parent 9e797b3245
commit 2e68b71831
1 changed files with 9 additions and 9 deletions

View File

@ -18,24 +18,24 @@ function __epprint(str) {
console.log(`%c[EndPwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
}
// define this with a default value as a fallback
var __goodies = {
guilds: [],
devs: [],
bots: [],
users: {}
};
exports = {
preload: function () {
// define this with a default value as a fallback
window.__goodies = {
guilds: [],
devs: [],
bots: [],
users: {}
};
function fetchGoodies() {
// fetch goodies.json
__epprint('fetching endpwn cutomizer data from server...');
fetch('https://endpwn.cathoderay.tube/goodies.json?_=' + Date.now())
.then(x => x.json())
.then(r => __goodies = r);
.then(r => window.__goodies = r);
}
// Fetch goodies now and every half hour