Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbox-build: broadcast update #1289

Closed
mischnic opened this issue Feb 9, 2018 · 2 comments
Closed

workbox-build: broadcast update #1289

mischnic opened this issue Feb 9, 2018 · 2 comments
Labels
Breaking Change Denotes a "major" semver change. workbox-build

Comments

@mischnic
Copy link

mischnic commented Feb 9, 2018

Library Affected:
workbox-build, maybe other?

Browser & Platform:
Chrome 64, workbox-build@3.0.0-beta.0

Issue or Feature Request Description:
The documentation for generateSW at https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config says the option key is broadcastUpdate, while in reality it is broadcastCacheUpdate.

After that's changed, the service worker throws an error:
Uncaught TypeError: Cannot read property 'Plugin' of undefined

sw.js:

importScripts(
  "https://storage.googleapis.com/workbox-cdn/releases/3.0.0-beta.0/workbox-sw.js"
);

workbox.skipWaiting();
workbox.clientsClaim();

self.__precacheManifest = [...].concat(self.__precacheManifest || []);
workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

workbox.routing.registerNavigationRoute("/dist/index.html");

workbox.routing.registerRoute(/http:\/\/cors-anywhere.herokuapp.com\/http:\/\/tycho.usno.navy.mil\/cgi-bin\/time.pl/, workbox.strategies.networkFirst({ plugins: [new workbox.broadcastCacheUpdate.Plugin({"channelName":"my-update-channel"})] }), 'GET');
workbox.routing.registerRoute("https://cdn.rawgit.com/parcel-bundler/website/01a1f7dd/src/assets/parcel%403x.png", workbox.strategies.cacheFirst(), 'GET');

config:

"runtimeCaching": [
	{
		"urlPattern": [
			"http://cors-anywhere.herokuapp.com/http://tycho.usno.navy.mil/cgi-bin/time.pl"
		],
		"handler": "networkFirst",
		"options": {
			"broadcastCacheUpdate": {
				"channelName": "my-update-channel"
			}
		}
	},
	{
		"urlPattern": "https://cdn.rawgit.com/parcel-bundler/website/01a1f7dd/src/assets/parcel%403x.png",
		"handler": "cacheFirst"
	}
]
@jeffposnick
Copy link
Contributor

jeffposnick commented Feb 9, 2018

Thanks for pointing that out—we'll get that mapping updated. It's actually intended to be the value that's in the docs.

@jeffposnick
Copy link
Contributor

(Marking this as breaking-change so we make sure to take note of it when documenting the v3 options.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change Denotes a "major" semver change. workbox-build
Projects
None yet
Development

No branches or pull requests

2 participants