Load character roster from localStorage upon startup
This commit is contained in:
parent
5c84c35b05
commit
241196186b
14
index.html
14
index.html
@ -433,6 +433,16 @@
|
|||||||
input.disabled = !toUnlock;
|
input.disabled = !toUnlock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const saveCharacterRoster = () => {
|
||||||
|
if (!checkLocalStorage()) {
|
||||||
|
alert("Local Storage is not available, cannot save roster.");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem("character-roster", JSON.stringify())
|
||||||
|
};
|
||||||
|
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
"DOMContentLoaded",
|
"DOMContentLoaded",
|
||||||
() => {
|
() => {
|
||||||
@ -440,6 +450,10 @@
|
|||||||
document.getElementById("no-local-storage").style.display = "initial";
|
document.getElementById("no-local-storage").style.display = "initial";
|
||||||
alert("Local Storage is not available, saving and loading data will be unavailable.");
|
alert("Local Storage is not available, saving and loading data will be unavailable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var newRoster = localStorage.getItem("character-roster");
|
||||||
|
|
||||||
|
characterRoster = (newRoster === null) ? {} : JSON.parse(newRoster);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user