Download Latest Version Workbox v7.4.1 source code.zip (1.5 MB)
Email in envelope

Get an email when there's a new version of workbox

Home / v3.4.1
Name Modified Size InfoDownloads / Week
Parent folder
workbox-v3.4.1.zip 2018-07-12 156.9 kB
workbox-v3.4.1.tar.gz 2018-07-12 101.6 kB
README.md 2018-07-12 2.8 kB
Workbox v3.4.1 source code.tar.gz 2018-07-12 522.7 kB
Workbox v3.4.1 source code.zip 2018-07-12 860.4 kB
Totals: 5 Items   1.6 MB 0

🎉 What's New?

Support for navigation preload

The new workbox-navigation-preload module provides a simple way of opting-in to navigation preload on browsers that support the feature. When run on browsers which lack navigation preload support, using the module will have no effect.

To take advantage of this new feature, you should make sure to set up a route that will match navigation requests, and uses a strategy that makes use of the response from the network, like networkFirst, staleWhileRevalidate, networkOnly, or cacheFirst.

:::js
// Enable navigation preloads.
workbox.navigationPreload.enable();

// Swap in networkOnly, cacheFirst, or staleWhileRevalidate as needed.
const strategy = workbox.strategies.networkFirst({
  cacheName: 'cached-navigations',
  plugins: [
    // Any plugins, like workbox.expiration, etc.
  ],
});

const navigationRoute = new workbox.routing.NavigationRoute(strategy, {
  // Optionally, provide a white/blacklist of RegExps to determine
  // which paths will match this route.
  // whitelist: [],
  // blacklist: [],
});

workbox.routing.registerRoute(navigationRoute);

Developers who are already handling navigations by responding with precached HTML (potentially configured with an App Shell fallback) do not need to enable navigation preload! This feature is intended to reduce navigation latency for developers who can't precache their HTML, but still want to use Workbox to handle caching of other assets on their sites.

workbox.strategies now supports using custom CacheQueryOptions

Developers who want to customize how workbox.strategies performs its internal cache lookups can now pass in a matchOptions parameter to use as the CacheQueryOptions when cache.match() is called under the hood.

:::js
// Ignore all query parameters when performing cache lookups.
const strategy = workbox.strategies.staleWhileRevalidate({
  cacheName: 'runtime-cache',
  matchOptions: {
    ignoreSearch: true,
  },
});

Many thanks to @torbs for contributing this in https://github.com/GoogleChrome/workbox/pull/1561!

🐛 What's Fixed?

📖 Learn More

Check out our docs @ developers.google.com/web/tools/workbox/

Source: README.md, updated 2018-07-12