remove IndexedDB keys that shouldn't be keys, and remove unused table, and add commentary

This commit is contained in:
2024-01-01 15:30:41 -07:00
parent 28b6d9bbf9
commit 6eb26ea90c
5 changed files with 11 additions and 13 deletions

View File

@@ -414,11 +414,11 @@ async function appendDailyLog(message) {
const db = await openIndexedDB("TimeSafari");
const transaction = db.transaction("logs", "readwrite");
const store = transaction.objectStore("logs");
// will only keep one day's worth of logs
// only keep one day's worth of logs
const todayKey = new Date().toDateString();
const previous = await getRecord(store, todayKey);
if (!previous) {
await store.clear(); // clear out anything older than today
await store.clear(); // clear out everything previous when this is today's first log
}
let fullMessage = (previous && previous.message) || "";
if (fullMessage) {
@@ -468,9 +468,6 @@ async function fetchAllAccounts() {
if (!db.objectStoreNames.contains("accounts")) {
db.createObjectStore("accounts", { keyPath: "id" });
}
if (!db.objectStoreNames.contains("worker_log")) {
db.createObjectStore("worker_log");
}
};
openRequest.onsuccess = function (event) {