Currently it’s possible in the routes definition to specify those type :
url
, content
, template
, templateUrl
, component
or componentUrl
I think there is a missing type the : componentContent
Why ?
I had an idea to implement a “live reload” function to fix emergency bug in components code.
I have already done this by doing a custom code modification in F7 lib.
- All my routes are defined with “componentUrl” type
- In the F7 code, “Router.prototype.xhrRequest”, I intercept the request to “https://MY_EXTERNAL_SERVER/components/about.html”,
- I first check in IndexedDB if i previously created an entry for “about.html” with emergency fix requested.
- If NO fix => i modify the requestUrl to the local URL file (about.html).
- If YES fix => I go and fetch on my remote server the fixed about.html file, store it in the indexedDB file system, and resolve the Router.prototype.xhrRequest promise with the retreived content from my server. Next calls to the about.html FIXED will be donne from IndexedDB by intercepting next remote fetch request.
Like that, i have fixed about.html with juste one download only and after we stay “offline”.
At the next Store update, i will include the fixed about.html files and so on…
Questions are :
- What do you think of this emergency update system. It’s way cheaper that AppFlow for example, with infinite updates.
- I miss the componentContent type. It would avoid me to “hack” the code. I would just feed componentContent with the string that my server would have. Instead of “hacking” componentUrl code.