forked from profectus/Profectus
Added incredibly dangerous deleteLowerSaves function to window
This commit is contained in:
parent
1bfa66e1c9
commit
7f4d57d3e4
1 changed files with 9 additions and 1 deletions
|
@ -140,14 +140,22 @@ window.onbeforeunload = () => {
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
/**
|
/**
|
||||||
* Augment the window object so the save function, and the hard reset function can be accessed from the console.
|
* Augment the window object so the save, hard reset, and deleteLowerSaves functions can be accessed from the console.
|
||||||
*/
|
*/
|
||||||
interface Window {
|
interface Window {
|
||||||
save: VoidFunction;
|
save: VoidFunction;
|
||||||
hardReset: VoidFunction;
|
hardReset: VoidFunction;
|
||||||
|
deleteLowerSaves: VoidFunction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.save = save;
|
window.save = save;
|
||||||
export const hardReset = (window.hardReset = async () => {
|
export const hardReset = (window.hardReset = async () => {
|
||||||
await loadSave(newSave());
|
await loadSave(newSave());
|
||||||
});
|
});
|
||||||
|
export const deleteLowerSaves = (window.deleteLowerSaves = () => {
|
||||||
|
const index = Object.values(settings.saves).indexOf(player.id) + 1;
|
||||||
|
Object.values(settings.saves)
|
||||||
|
.slice(index)
|
||||||
|
.forEach(id => localStorage.removeItem(id));
|
||||||
|
settings.saves = settings.saves.slice(0, index);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue