ExtJs Application Cache warning

天大地大妈咪最大 提交于 2020-05-14 07:24:45

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/60969506/extjs-application-cache-warning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!