feat: complete TASK-WP0-06 public cache
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
createPublicAssetCacheForTest,
|
||||
registerPublicAssetServiceWorker,
|
||||
} from "../../../apps/web/src/public-asset-cache.js";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
dadaCacheProbe: {
|
||||
cache: ReturnType<typeof createPublicAssetCacheForTest>;
|
||||
register(): Promise<void>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
let tick = 1_000;
|
||||
const cache = createPublicAssetCacheForTest({ maxBytes: 20, now: () => ++tick });
|
||||
window.dadaCacheProbe = {
|
||||
cache,
|
||||
async register() {
|
||||
await registerPublicAssetServiceWorker();
|
||||
await navigator.serviceWorker.ready;
|
||||
document.querySelector("#status")!.textContent = "ready";
|
||||
},
|
||||
};
|
||||
void window.dadaCacheProbe.register();
|
||||
Reference in New Issue
Block a user