Maybe now then?

This commit is contained in:
Marco van Dijk 2024-12-19 16:30:43 +01:00
parent 2547a026e7
commit 381d4a746f

View File

@ -103,9 +103,15 @@ async function withStorageLock(fn) {
}
async function writeToStorage(key, data) {
try {
const serialized = JSON.stringify(data);
if (!serialized) throw new Error("Serialization failed");
await withStorageLock(async () => {
await storage.setItem(key, data);
await storage.setItem(key, JSON.parse(serialized));
});
} catch (err) {
console.error("Error writing to storage:", err.message);
}
}
// Process the task queue continuously