You've already forked remote-local-storage
support multiple hosts - by qwencoder
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
|
||||
<script>
|
||||
|
||||
// Load local storage from server on page load
|
||||
(async () => {
|
||||
const resp = await fetch("loadLS");
|
||||
const lsItems = JSON.parse(await resp.text());
|
||||
@@ -13,6 +13,8 @@
|
||||
console.log("Loaded local storage");
|
||||
})();
|
||||
|
||||
// Function to save local storage to server
|
||||
// This function is called periodically to sync localStorage with server
|
||||
function postLocalStorage() {
|
||||
(async () => {
|
||||
const resp = await fetch("saveLS", {
|
||||
@@ -26,6 +28,7 @@
|
||||
})();
|
||||
}
|
||||
|
||||
// Set up periodic saving every 10 minutes
|
||||
setInterval(postLocalStorage, 10 * 60 * 1000) // 10 mins
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user