Add a picture of me
This commit is contained in:
@ -18,38 +18,7 @@ async function fetch_build_id()
|
||||
return json.build_id;
|
||||
}
|
||||
|
||||
(async function() {
|
||||
build_id = await fetch_build_id();
|
||||
})();
|
||||
|
||||
|
||||
const asyncIntervals = [];
|
||||
|
||||
const runAsyncInterval = async (cb, interval, intervalIndex) => {
|
||||
await cb();
|
||||
if (asyncIntervals[intervalIndex]) {
|
||||
setTimeout(() => runAsyncInterval(cb, interval, intervalIndex), interval);
|
||||
}
|
||||
};
|
||||
|
||||
const setAsyncInterval = (cb, interval) => {
|
||||
if (cb && typeof cb === "function") {
|
||||
const intervalIndex = asyncIntervals.length;
|
||||
asyncIntervals.push(true);
|
||||
runAsyncInterval(cb, interval, intervalIndex);
|
||||
return intervalIndex;
|
||||
} else {
|
||||
throw new Error('Callback must be a function');
|
||||
}
|
||||
};
|
||||
|
||||
const clearAsyncInterval = (intervalIndex) => {
|
||||
if (asyncIntervals[intervalIndex]) {
|
||||
asyncIntervals[intervalIndex] = false;
|
||||
}
|
||||
};
|
||||
|
||||
setAsyncInterval(async function () {
|
||||
setInterval(async function() {
|
||||
let new_build_id = await fetch_build_id();
|
||||
if (build_id !== new_build_id) {
|
||||
location.reload(true);
|
||||
|
Reference in New Issue
Block a user