-
Notifications
You must be signed in to change notification settings - Fork 17
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
Switch from applicationCache to service workers #1204
Comments
From @MartijnR on February 16, 2016 20:32 to fix afterwards:
|
From @MartijnR on August 17, 2018 23:54 First thing to check is the 24 hour thing, as we need users to be able to stay disconnected for much longer. https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API |
This is becoming urgent.
|
In case it's of interest, google does have a rough tool aimed to help migrate from appcache to service workers: https://github.com/GoogleChromeLabs/sw-appcache-behavior It claims to be work in progress (although fairly inactive and so for a complex setup may not work, but could be worth a try. |
Thank you. I wasn't aware of that tool! |
|
LanguagesWould be useful to use the form definition to determine which languages to cache. This would enable proper UI language switching in the future. Alternatively, we could dynamically add any additional languages the user switches to while online. For now, planning to implement this initially:
Future:
Media labelsCurrently stored in indexedDb. This was done to keep applicationCache as static as possible for all forms. Not sure if still the best approach, but I think so. If we dynamically add images to the cache, I think we cannot ensure these survive when a service worker updates. They will be re-added for the form load that triggers the update, but not for any other cached forms (until the user reloads them whilst online). Alternatively, we could have a separate cache for media for each form ID, and a common cache for common resources. To keep the scope of this initial work limited, we essentially mimic the existing ApplicationCache, and keep the form cache as is. Service worker scopeIf the service worker is installed from a script at /x/somepath.js, the scope is /x/. With the current appCache implementation, resource files come from root locations as well. We could either change the scope to root or support /x/paths for all application resources. In the former case, any online-only forms will also use the cache if that user has once opened an offline-capable form. Since there will be no user-feedback ("restart page") in the online-only pages, it seems best to let /x/ be the scope. Migration
Would be nice if at 2, the user is prompted to reload |
future:
|
Note: The explicit list of resources may not serve much of a purpose (vs. dynamically caching whatever is requested in the scope of the service worker (/x/path/to/resource). But we need to update the (byte value) of the service worker if any resource changes, so we'll have to go through all resources anyway. However, it's worth considering just incrementing the service worker (version) whenever, Enketo is restarted or gets a new git tag or something. The only issue with that would be for Enketo developers (but developer tools has a setting to 'Update on reload', and it is currently also a bit of a pain due to the redis cache). Update:
|
From @MartijnR on February 3, 2016 21:59
applicationCache is being deprecated
https://html.spec.whatwg.org/multipage/browsers.html#offline
Too early at the moment. http://caniuse.com/#feat=serviceworkers
Copied from original issue: kobotoolbox/enketo-express#401
The text was updated successfully, but these errors were encountered: