Skip to content

strategy ​

Function @vite-pwa/workbox-swkit/streams
ts
strategy(sourceFunctions: StreamsHandlerCallback[], headersInit?: HeadersInit): RouteHandlerCallback

A shortcut to create a strategy that could be dropped-in to Workbox's router.

On browsers that do not support constructing new ReadableStreams, this strategy will automatically wait for all the sourceFunctions to complete, and create a final response that concatenates their values together.

Parameters ​

  • sourceFunctions – An array of functions similar to workbox-routing~handlerCallback but that instead return a StreamSource (or a Promise which resolves to one).

  • headersInit – If there's no Content-Type specified, 'text/html' will be used by default.

Returns:

Released under the MIT License.