NetworkOnly extends module:workbox-runtime-caching.Handler

An implementation of a network-only request strategy.

The advantage to using this versus directly calling fetch() is that it will trigger the plugins defined in the underlying RequestWrapper.

Example

// Set up a route to match any requests made for URLs that end in .txt.
// The requests are handled with a network-only strategy.
const route = new workbox.routing.RegExpRoute({
  regExp: /\.txt$/,
  handler: new workbox.runtimeCaching.NetworkOnly(),
});

const router = new workbox.routing.Router();
router.registerRoute({route});

Instance Methods

this.handle(input) Promise.<Response>

The handle method will be called by the Route class when a route matches a request.

Parameters
input Object
Properties
event FetchEvent

The event that triggered the service worker's fetch handler.

Returns Promise.<Response>

The response from the network.