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

consider adding a service worker #1689

Closed
patrickkettner opened this issue Mar 27, 2015 · 3 comments
Closed

consider adding a service worker #1689

patrickkettner opened this issue Mar 27, 2015 · 3 comments

Comments

@patrickkettner
Copy link
Contributor

Just a basic caching worker, like this one can greatly speed up a lot of websites.

@jpmedley
Copy link

jpmedley commented May 2, 2016

+1

@jeffposnick
Copy link

Integrating with a build-time tool like sw-precache would be more appropriate than using that sample code—I've sprinkled a copious number of comments throughout it like

// If at any point you want to force pages that use this service worker to start using a fresh
// cache, then increment the CACHE_VERSION value. It will kick off the service worker update
// flow and the old cache(s) will be purged as part of the activate event handler when the
// updated service worker is activated.

and

// This sample illustrates an aggressive approach to caching, in which every valid response is
// cached and every request is first checked against the cache.
// This may not be an appropriate approach if your web application makes requests for
// arbitrary URLs as part of its normal operation (e.g. a RSS client or a news aggregator),
// as the cache could end up containing large responses that might not end up ever being accessed.
// Other approaches, like selectively caching based on response headers or only caching
// responses served from a specific domain, might be more appropriate for those use cases.

The approach to service worker generation that the Web Starter Kit project is using (based on sw-precache) could serve as a model. Build-time integration ensures that as a site's static resource change over time, users' caches will be updated efficiently, without additional work from each developer.

@roblarsen
Copy link
Member

Going to the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants