offlibraryHandler
function offlibraryHandler(options?): object;Defined in: src/workbox.ts:97
A Workbox route handler that answers from Offlibrary’s storage (200, or 206 for Range) and
otherwise hands the request to fallback (default: the network).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
OfflibraryHandlerOptions |
Returns
Section titled “Returns”object
handle()
Section titled “handle()”handle(options): Promise<Response>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
WorkboxRouteHandlerOptions |
Returns
Section titled “Returns”Promise<Response>
Example
Section titled “Example”import { registerRoute } from 'workbox-routing';import { NetworkOnly } from 'workbox-strategies';import { offlibraryMatch, offlibraryHandler } from 'offlibrary/workbox';
registerRoute(offlibraryMatch, offlibraryHandler({ fallback: new NetworkOnly() }));