declare goodies in window

This commit is contained in:
Astra 2018-05-08 00:55:47 -04:00
parent 9e797b3245
commit 2e68b71831

View file

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