How to use workbox-streams - 1 common examples

To help you get started, we’ve selected a few workbox-streams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github philipwalton / blog / assets / sw / routes / pages.js View on Github external
const pagesMatcher = ({url}) => {
  return url.hostname === location.hostname &&
      (url.pathname === '/' ||

const contentHandler = ({event, url}) => {
  return contentStrategy.handle({
    request: new Request(`${url.pathname}index.content.html`),

const streamHandler = streamsStrategy([
  ({event}) => precacheHandler({
    request: new Request('/shell-start.html'),
  ({event}) => precacheHandler({
    request: new Request('/shell-end.html'),

const pagesHandler = (opts) => {
  // If the request is a navigation request, assume it's going to be consumed
  // by a browser and return the full stream. Otherwise assume it's from
  // either an SPA load or a CACHE_URLS message, so only the content partial
  // needs to be returned.


A library that makes it easier to work with Streams in the browser.

Latest version published 11 months ago

Package Health Score

80 / 100
Full package analysis

Popular workbox-streams functions