distant storage

This commit is contained in:
m
2026-09-09 21:55:51 +02:00
parent 2e01484383
commit ce966e67c5
5 changed files with 107 additions and 1 deletions
+47
View File
@@ -0,0 +1,47 @@
import { getUserPreferences } from "../services/localStorage";
import type { UserPreferences } from "../services/localStorage"
let syncStartedAt: null | number = null;
export async function useSyncDevice() {
initialize()
async function initialize() {
if ( syncStartedAt ) return;
syncStartedAt = Date.UTC(Date.now());
while (true) {
await sync()
await new Promise((resolve)=>{
setTimeout(() => {
resolve(true)
}, 1000);
})
}
}
async function sync() {
console.info("Sync started")
const userPreferences = await getUserPreferences()
console.log(userPreferences)
}
async function setSyncMode( mode: UserPreferences ) {
}
return {
}
}