Make Edits persist after reload
This commit is contained in:
@ -44,6 +44,17 @@ function shrinkTableHead(scroll){
|
||||
|
||||
}
|
||||
|
||||
function loadStorage() {
|
||||
let content = localStorage.getItem("pc_data");
|
||||
if( typeof content == "string" ){
|
||||
app.ports.localStorageRecieve.send( content );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Load last state of pc
|
||||
loadStorage();
|
||||
|
||||
// EVENT LISTENERS
|
||||
pc_ram_scroller.addEventListener("scroll", shrinkTableHead);
|
||||
@ -57,3 +68,9 @@ app.ports.sendUUpdate.subscribe( (message) => {
|
||||
// Make sure that even when the calculation takes longer it will scroll correctly
|
||||
setTimeout( scrollToCurrent, 100 );
|
||||
} );
|
||||
|
||||
// Recieve LocalSession Updates via Ports
|
||||
app.ports.localStorageSend.subscribe( (message) => {
|
||||
console.log("localSessionSend: ", message);
|
||||
localStorage.setItem("pc_data", message);
|
||||
} );
|
||||
|
Reference in New Issue
Block a user