Overview¶
Offline Manager¶
The Offline Manager is responsible for handling the application's offline capabilities. It provides the following functionalities:
- Service Worker Registration: Manages the registration of the service worker to enable offline functionality.
- Offline Mode Toggle: Allows users to enable or disable offline mode as needed.
- Data Prefetching: Supports on-demand prefetching of classroom or student data to ensure availability during offline usage.
import { writable, get } from 'svelte/store';
import { pwaInfo } from 'virtual:pwa-info';
import DataPrefetcherWebWorker from './data-prefetcher-web-worker?worker';
import type {
WorkerStartCommandRequest,
WorkeStudentStartCommandRequest
} from './data-prefetcher-web-worker';
import { offlineDb } from './db';
Implementation can be found in src/lib/offline/OfflineManager.ts.
Offline Db¶
The Offline Database provides a way to store user operations along with the necessary data when in offline mode. It uses dexie to manage IndexedDB storage and retrieval. It provides the following functionalities:
- Ability to store preferences, including various settings like whether the service worker is enabled, what student/classroom data is downloaded, their timestamps, etc.
- Ability to store and manage daily attendance.
- Ability to store and manage daily assessment records.
Implementation can be found in src/lib/offline/db.ts.