Wrapping up for the day. Lots of improvements. More menu options for location and device related.

This commit is contained in:
Scott Idem
2024-10-16 18:48:14 -04:00
parent 590d274910
commit 63fea17472
13 changed files with 482 additions and 236 deletions

View File

@@ -94,8 +94,9 @@ $slct = {
}
// console.log(`$slct = `, $slct);
// Check if the last reload timestamp for $ae_loc.last_idb_reload is no more than 15 minutes ago.
let default_idb_reload_time = 120 * 60 * 1000; // 120 minutes
// IDB caches - Check if the last reload timestamp for $ae_loc.last_idb_reload is no more than 15 minutes ago.
let default_idb_reload_time = 120 * 60 * 1000; // 15 minutes?
let trusted_idb_reload_time = 4 * 60 * 60 * 1000; // 4 hours or 120 minutes?
if (!$ae_loc.last_idb_reload) {
console.log(`Last reload not found. Need to reset.`);
@@ -116,7 +117,7 @@ if (!$ae_loc.last_idb_reload) {
// window.location.reload();
}
} else if ($ae_loc.last_idb_reload && (Date.now() - $ae_loc.last_idb_reload) > default_idb_reload_time) {
} else if ($ae_loc.last_idb_reload && $ae_loc.trusted_access && (Date.now() - $ae_loc.last_idb_reload) > trusted_idb_reload_time) {
console.log(`Last reload too old:`, $ae_loc.last_idb_reload);
if (browser) {
@@ -132,10 +133,25 @@ if (!$ae_loc.last_idb_reload) {
// localStorage.removeItem('ae_loc');
// localStorage.removeItem('events_loc');
// window.location.reload();
window.location.reload();
}
} else if ($ae_loc.last_idb_reload && (Date.now() - $ae_loc.last_idb_reload) > default_idb_reload_time) {
console.log(`Last reload too old:`, $ae_loc.last_idb_reload);
if (browser) {
$ae_loc.last_idb_reload = Date.now();
// Clear Indexed DB as well
indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_events_db');
// localStorage.removeItem('ae_loc');
// localStorage.removeItem('events_loc');
window.location.reload();
}
} else if (browser) {
console.log(`Last reload is recent:`, $ae_loc.last_idb_reload);
console.log(`Last reload is recent: ${$ae_loc.last_idb_reload}`);
// Clear Indexed DB as well
// indexedDB.deleteDatabase('ae_core_db');
// indexedDB.deleteDatabase('ae_events_db');