docs-serwist-runtime-caching-caching-strategies-network-only.md
Workbox
An implementation of the network only request strategy.
This class is useful if you require specific requests to only be fulfilled from the network.
If the network request fails, this will throw a SerwistError exception.
plugins — Plugins to use in conjunction with this caching strategy.fetchOptions — Options passed to non-navigation fetch() calls made by this strategy.networkTimeoutSeconds — If set, any network requests that fail to respond within the timeout will fallback to the cache.sw.ts
import { NetworkOnly, Serwist } from "serwist";
const serwist = new Serwist({
runtimeCaching: [
{
matcher: ({ url }) => url.pathname.startsWith("/admin/"),
handler: new NetworkOnly(),
},
],
});
Here is a list of resources you can read to learn more about NetworkOnly: