26 lines
798 B
JavaScript
26 lines
798 B
JavaScript
/*
|
|
* User entry point — bootstraps the task-processing workspace.
|
|
*
|
|
* Opens the shared IndexedDB for admin entity cache, then initializes the
|
|
* user module which manages task processing: open task, fill in records,
|
|
* attach images, save as draft or final.
|
|
*/
|
|
|
|
import { state } from './js/state.js';
|
|
import { openDatabase } from './js/db.js';
|
|
import { initUser } from './js/user.js';
|
|
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
/* Open the shared IndexedDB so admin entity cache is accessible. */
|
|
state.db = await openDatabase();
|
|
await initUser();
|
|
});
|
|
|
|
/* Re-init when navigating back (fixes stale localStorage after bfcache) */
|
|
window.addEventListener('pageshow', async (e) => {
|
|
if (e.persisted) {
|
|
state.db = await openDatabase();
|
|
await initUser();
|
|
}
|
|
});
|