@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
43 lines (42 loc) • 1.74 kB
TypeScript
import GirafeSingleton from '../../base/GirafeSingleton.js';
import LayerWmts from '../../models/layers/layerwmts.js';
import { Extent } from 'ol/extent.js';
declare class OfflineManager extends GirafeSingleton {
private serviceWorker;
private readonly indexedDbHelper;
private get map();
private get state();
private database;
private totalLength;
private counter;
private progressCallback?;
private storeVersion;
private dbCacheName;
private readonly tilesStoreName;
private readonly bboxStoreName;
private readonly vectorLayer;
initializeSingleton(): void;
initializeOfflineState(isOffline: boolean): void;
private registerEvents;
/** Exports all the WMTS tiles for the layers in parameter and store them to local cache */
exportWMTSTiles(bbox: Extent, wmtsLayers: LayerWmts[], progressCallback?: CallableFunction): Promise<void>;
upgradeIndexedDb(database: IDBDatabase): void;
/** The offline manager works with a ServiceWorker in charge of intercepting
* the fetch requests and read the data from the local cache if the application
* is offline. This method defines the servicework object to use.
* Without this, the offline mode won't work.
*/
setServiceWorker(sw: ServiceWorker | null, storeVersion: number, dbCacheName: string): Promise<void>;
switchOffline(): void;
private getAllTileUrls;
private getTileUrlsForWmtsLayer;
private fetchAndSaveTiles;
private doWork;
getTotalSizeMB(): Promise<number>;
private clearStore;
clearTileStore(): Promise<void>;
clearBBoxStore(): Promise<void>;
private saveBoundingBox;
displayBoundBoxes(): Promise<void>;
}
export default OfflineManager;