Runtime Resources
This MR originally only had changes to angular.json as pre-work for the Runtime Resources. (changes to the translation service come from !811+)
Now the full Service/Module ended up here. This should have been an extra MR sorry about this :(
This MR introduces RccPublicRuntimeTextResourceService
. This Service is meant to load (text) Resources at Runtime that are not available earlier.
At first glance this service does little more than starting a fetch request; but the setup comes with two challenges:
- We need to pre-fetch all the data in order for the service worker to cache everything. If we don't do that the runtime resources will not be available offline.
- We have to make sure that all translatable resources are present for all available languages; and if they aren't, draw attention to the incompleteness right away. (If we don't, someone will sooner or later forget to add the french version of some resource and we will never notice)
At the end of the day the service got a bit larger than just a fetch, but the consumer of it won't have to bother with caching or checking translations or consistency / completeness of the provided data.
Things I did besides the new service/module
- moved runtime config to subfolder
- updated angular.json
How to test?
- import
ExampleRuntimeResourceModule
to have the app request example data. This will log info to the console, about which resources where requested and failed. This willl probably not fail though, because our local dev server will allways send index.html as response. - import
MockRccPublicRuntimeTextResourceModule
to provide example data fulfilling the request fromExampleRuntimeResourceModule
- create the files, mentioned in the logs to
/dist/app/hcp/local
. The log should confirm that those files where loaded. - turning off the dev server and realoading the page should still give you the previously cached responses
Edited by Andreas Pittrich