ExtJs应用程序高速缓存警告 [英] ExtJs Application Cache warning

查看:170
本文介绍了ExtJs应用程序高速缓存警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用ExtJs编写的单页应用程序.我没有使用应用程序缓存,但是当应用程序启动时,我在Chrome中看到以下警告:

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:

[不推荐使用]不赞成使用应用程序缓存API,并将在2020年4月左右在M82中将其删除.请参见 https://www.chromestatus.com/features/6192449487634432 了解更多详情.

此问题已在Sencha论坛上多次发布(此处)进行操作回来几年了.唯一的回应是来自非Sencha的海报,称应该没问题".并非您希望的答案.

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.

有人知道如何消除此警告吗?考虑到我没有显式使用应用程序缓存,这听起来好像ExtJs可能在后台对其进行了处理.这就是我所关心的.

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.

推荐答案

我决定调查此问题,因为我发现这个问题很有趣.

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

简短的回答是,除非您明确使用applicationCache,否则它实际上不会以任何方式影响您的应用程序.

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

详细信息:

即使您只是尝试调用window.applicationCache属性,也会出现警告

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

applicationCache的作用是什么?它缓存静态文件(js和css)以使您的应用程序脱机工作.该技术已被ServiceWorker所取代.使用applicationCache进行缓存的工作方式如下(简短说明,在MDN上完全显示):

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. 您创建了一个特殊组成的清单...
  2. 并在页面上html标记的manifest属性中设置其路径
  3. 之后,该清单中的文件将保存在applicationCache中
  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

在Sencha应用程序中,这是由于脚本

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.

在此文件中,将基于applicationCache的内置包装和创建侦听器分配给applicationCache.这些侦听器的处理程序更改包装器内部的状态并调用notifyUpdateReady方法,该方法又调用全局appupdate事件. 同时,所有这些代码都是抽象的,几乎对applicationCache的整体操作没有影响.

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.

如有疑问,可以模拟禁用applicationCache.在if (_cache){...之前的checkAllUpdates方法中设置调试器,并覆盖_cache(_cache = undefined;).然后将控制权返回给浏览器.什么都不会发生.

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.

我使用SenchaFiddle示例测试了所有这一切. 那里根本没有使用缓存.它没有明显的

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

我重复一下结论-如果您没有显式使用applicationCache-您无需担心.您可以通过查看页面代码并查找清单连接来检查是否使用了它.您还可以在控制台中执行以下代码

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

如果结果为0,则说明您的应用程序中的缓存未初始化

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

这篇关于ExtJs应用程序高速缓存警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆