ExtJs Application Cache warning
Asked Answered
R

2

5

I have a single page app written with ExtJs. I'm not using the application cache but when the app launches I see the following warning in Chrome:

[Deprecation] Application Cache API use is deprecated and will be removed in M82, around April 2020. See https://www.chromestatus.com/features/6192449487634432 for more details.

This question has been posted multiple times on the Sencha forums (here and here) going back several years. The only response has been from a non-Sencha poster saying it "should be ok." Not exactly the answer you would hope for.

Does anyone have any idea how to get rid of this warning? Considering I am not explicitly using the application cache it sounds as if ExtJs might be doing something with it in the background. That is what concerns me.

Revolt answered 1/4, 2020 at 11:8 Comment(0)
R
5

I decided to investigate this problem because I found the question interesting.

The short answer is that it really will not affect your application in any way unless you explicitly use applicationCache.

Details:

A warning appears even if you simply try to call the window.applicationCache property

What is applicationCache used for? It caches static files (js and css) to make your application work offline. This technology has been replaced by ServiceWorker's. Caching using applicationCache works as follows (short description, full on MDN):

  1. You create a specially composed manifest ...
  2. and set path to it in manifest attribute of the html tag on your page
  3. after that the files from that manifest will be saved in applicationCache

In the Sencha application, this appears as a result of the script https://docs.sencha.com/extjs/6.2.0/classic/src/Microloader.js.html which injected into your page.

In this file, a built wrapper over applicationCache and create listeners are assigned to the applicationCache. The handlers of these listeners change the status inside the wrapper and call the notifyUpdateReady method, which in turn calls the global appupdate event. At the same time, all this code is abstract and has almost no effect on the overall operation of applicationCache.

If in doubt, you can simulate disabling applicationCache. Set the debugger in checkAllUpdates method before if (_cache){... and override _cache (_cache = undefined;). Then return control to the browser. Nothing will happen.

I tested all this using the SenchaFiddle example. Cache is not used there at all. It dosen't have manifest

I repeat the conclusion - if you are not using applicationCache explicitly - you have nothing to worry about. You can check whether it is used by you by looking at the page code and looking for the manifest connection. You can also execute the following code in the console

 window.applicationCache.status

if the result is 0, the cache was not initialized in your application

Ruthannruthanne answered 1/4, 2020 at 14:55 Comment(2)
Thank you very much for the detailed answer. I can sleep a little better now. Of course the question I have now is why didn't Sencha ever provide an answer like that?Revolt
Alas, I do not know the answer to this question. I can definitely say that asking questions on the forum no longer makes sense - he moved here. I don't seen official sencha's representatives here. But Sencha still has to accept bugsRuthannruthanne
B
7

You can turn appCache off in app.json:

/**
  * Settings specific to production builds.
  */
"production": {
    "output": {
        "appCache": {
            "enable": true, // <- change this to false and rebuild
            "path": "cache.appcache"
        }
    },
Blue answered 18/5, 2020 at 7:34 Comment(1)
When I set mine to false and re-built the production app, the files were not generated and the warning disappeared.Blue
R
5

I decided to investigate this problem because I found the question interesting.

The short answer is that it really will not affect your application in any way unless you explicitly use applicationCache.

Details:

A warning appears even if you simply try to call the window.applicationCache property

What is applicationCache used for? It caches static files (js and css) to make your application work offline. This technology has been replaced by ServiceWorker's. Caching using applicationCache works as follows (short description, full on MDN):

  1. You create a specially composed manifest ...
  2. and set path to it in manifest attribute of the html tag on your page
  3. after that the files from that manifest will be saved in applicationCache

In the Sencha application, this appears as a result of the script https://docs.sencha.com/extjs/6.2.0/classic/src/Microloader.js.html which injected into your page.

In this file, a built wrapper over applicationCache and create listeners are assigned to the applicationCache. The handlers of these listeners change the status inside the wrapper and call the notifyUpdateReady method, which in turn calls the global appupdate event. At the same time, all this code is abstract and has almost no effect on the overall operation of applicationCache.

If in doubt, you can simulate disabling applicationCache. Set the debugger in checkAllUpdates method before if (_cache){... and override _cache (_cache = undefined;). Then return control to the browser. Nothing will happen.

I tested all this using the SenchaFiddle example. Cache is not used there at all. It dosen't have manifest

I repeat the conclusion - if you are not using applicationCache explicitly - you have nothing to worry about. You can check whether it is used by you by looking at the page code and looking for the manifest connection. You can also execute the following code in the console

 window.applicationCache.status

if the result is 0, the cache was not initialized in your application

Ruthannruthanne answered 1/4, 2020 at 14:55 Comment(2)
Thank you very much for the detailed answer. I can sleep a little better now. Of course the question I have now is why didn't Sencha ever provide an answer like that?Revolt
Alas, I do not know the answer to this question. I can definitely say that asking questions on the forum no longer makes sense - he moved here. I don't seen official sencha's representatives here. But Sencha still has to accept bugsRuthannruthanne

© 2022 - 2024 — McMap. All rights reserved.