Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { MapLikeObject } from 'workbox-core/types.js';
|
|
import '../_version.js';
|
|
export interface RequestData extends MapLikeObject {
|
|
url: string;
|
|
headers: MapLikeObject;
|
|
body?: ArrayBuffer;
|
|
}
|
|
/**
|
|
* A class to make it easier to serialize and de-serialize requests so they
|
|
* can be stored in IndexedDB.
|
|
*
|
|
* Most developers will not need to access this class directly;
|
|
* it is exposed for advanced use cases.
|
|
*/
|
|
declare class StorableRequest {
|
|
private readonly _requestData;
|
|
/**
|
|
* Converts a Request object to a plain object that can be structured
|
|
* cloned or JSON-stringified.
|
|
*
|
|
* @param {Request} request
|
|
* @return {Promise<StorableRequest>}
|
|
*/
|
|
static fromRequest(request: Request): Promise<StorableRequest>;
|
|
/**
|
|
* Accepts an object of request data that can be used to construct a
|
|
* `Request` but can also be stored in IndexedDB.
|
|
*
|
|
* @param {Object} requestData An object of request data that includes the
|
|
* `url` plus any relevant properties of
|
|
* [requestInit]{@link https://fetch.spec.whatwg.org/#requestinit}.
|
|
*/
|
|
constructor(requestData: RequestData);
|
|
/**
|
|
* Returns a deep clone of the instances `_requestData` object.
|
|
*
|
|
* @return {Object}
|
|
*/
|
|
toObject(): RequestData;
|
|
/**
|
|
* Converts this instance to a Request.
|
|
*
|
|
* @return {Request}
|
|
*/
|
|
toRequest(): Request;
|
|
/**
|
|
* Creates and returns a deep clone of the instance.
|
|
*
|
|
* @return {StorableRequest}
|
|
*/
|
|
clone(): StorableRequest;
|
|
}
|
|
export { StorableRequest };
|