-
Notifications
You must be signed in to change notification settings - Fork 262
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
Allow to update the asset(s) that the SW cached #43
Comments
Great idea. By the way, do you have a real life use case you're already dealing with for this? Could help plan the implementation in the best way possible. |
I don't have a real life use case (at the moment :) |
I guess you'd want the cache to be updated following any change to the resources. Be it a spelling correcting, and accidental xss vector, a change of branding etc etc. |
any news on this? is there an alternative way to do this for now? |
+1 |
Ahh :) good reminder... On Sat, Sep 10, 2016 at 1:46 AM, Vu Khanh Truong [email protected]
|
OK, I took some time to think about this issue, and here is how I plan to approach this. Feedback and ideas would be welcome. First of all, I should say that UpUp behaves a bit differently than the traditional service worker caching pattern. The common approach is to cache on the service worker's This is why UpUp does the caching in response to a The proposed solution:
To summarize: UpUp will now save the offline content in a new cache every time the developer changes the list of files/content to cache, and/or passes a new version name. For example: UpUp.start({
'cache-version': 1,
'content-url': 'offline.html',
'assets': ['/img/logo.png']
}); Both of the following changes would cause a new cache to be used: // Changing a cache version
UpUp.start({
'cache-version': 2,
'content-url': 'offline.html',
'assets': ['/img/logo.png']
}); // Changing the assets to be cached
UpUp.start({
'cache-version': 1,
'content-url': 'offline.html',
'assets': ['/img/logo.png', '/css/style.css']
});
|
This change is live now 🎆 ! As of a67c12b, files are now saved in a separate cache every time the content of You can also manually force a cache update by adding or changing a For example: UpUp.start({
'cache-version': 'v2',
'content-url': '/offline.html',
'assets': ['/img/logo.png']
}); This is also in the docs. I still want to solve #12, and then I will release version 1.0.0 |
When we updating an asset (e.g. code, img etc') there should be an easy way to communicate it to upup so it could refresh the cached version.
The text was updated successfully, but these errors were encountered: