fake-service-worker
Version:
Fake service worker implementation for testing developer edge applications
21 lines (20 loc) • 934 B
TypeScript
export declare type CacheQueryOptions = {
ignoreMethod?: boolean | undefined;
ignoreSearch?: boolean | undefined;
ignoreVary?: boolean | undefined;
};
export declare class EdgeCache implements Cache {
private cache;
constructor();
private getKey;
getTTL(response: Response | Request): number;
/** Fetches url and caches it */
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
keys(request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Request[]>;
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>;
/** Basically match but returns array. -_-*/
matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise<readonly Response[]>;
put(request: RequestInfo, response: Response): Promise<void>;
}