Refresh Quickfix

This commit is contained in:
MollTheCoder 2023-01-19 22:15:31 -05:00 committed by GitHub
parent 9dccb52092
commit 694b5277c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,11 @@
/* Helps make managing many dependencies easier */
// Version 1.0.0
// Version 1.0.1
// Update Description: Refresh quickfix
let __needRefresh = false;
window.addEventListener("load", e=>{
if(__needRefresh) location.reload();
});
/*
* Requires that certain mods are installed for the callback to proceed.
* @param {array} mods - The mods your mod depends on.
@ -13,7 +18,7 @@ function requireMods(mods, cal) {
}
else {
__installMods(mods);
window.location.reload();
__needRefresh = true;
}
}
@ -47,9 +52,9 @@ function __installMods(mods) {
}
function __installMod(mod) {
let mods = JSON.parse(window.localStorage.getItem("enabledMods") || "[]");
let mods = JSON.parse(localStorage.getItem("enabledMods") || "[]");
mods.push(mod);
window.localStorage.setItem("enabledMods", JSON.stringify(mods));
localStorage.setItem("enabledMods", JSON.stringify(mods));
}
// Ensure it's available in the global scope