1
2
3
4
5
6
7
8
9
10
11
12
| import {StorageLocal} from "gs-br-ext";
|
| export async function cacheFetch( input: string | URL | globalThis.Request,init?: RequestInit): Promise<Response> {
| init || (init = {});
| init.cache = await StorageLocal.getValue('cache')
| console.log(new Date().toLocaleTimeString(),'cache:',init.cache,',execute url=', input)
| return await fetch(input, init);
| }
|
| export async function isCache() {
| return 'force-cache' === await StorageLocal.getValue('cache');
| }
|
|