ExtJS 4.2 - “同步 XMLHttpRequest"的可能原因;警告?

2021-12-25 00:00:00 php javascript extjs extjs4 extjs4.2

美好的一天,对于看似宽泛的问题标题感到抱歉.

Good day, sorry for the seemingly broad question title.

我正在使用 php 和 sql 为用户数据构建一个 ExtJS4 应用程序.一切都很顺利,直到有一天,我在我的 Java 控制台中注意到了这个错误:

I am building an ExtJS4 application using php and sql for the user data. Everything was going fine until one day, I notice this error in my java console:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. 
For more help, check http://xhr.spec.whatwg.org/.

最初,我并没有那么烦恼,因为我的应用程序在本地网络中测试时加载得相当好.但是,当我上传到在线服务器并对其进行测试后,应用程序加载速度非常慢,有时根本无法加载.

Initially, I wasn't that troubled since my application was loading fairly well while testing it in my local network. However, once I uploaded to an online server and tested it, the application loaded really slowly and sometimes it wouldn't load at all.

我不记得在我的应用程序中的任何地方调用过 XMLHttpRequest,所以我对我突然收到此警告的方式或原因感到目瞪口呆.

I don't recall calling an XMLHttpRequest anywhere in my application, so I'm dumbfounded on how or why I'm getting this warning all of a sudden.

我连接到我的数据库并返回的唯一方法是通过 Stores.

The only way I connect to my database and back is via Stores.

另外,作为一个附带问题,有没有办法让 ExtJS4 应用程序加载得更快?我已经最小化了我使用的图像/图标的大小,我认为问题在于商店,但我的商店都没有设置为自动加载.

Also, as a side question, is there a way to make ExtJS4 applications load faster? I've minimized the size of the images/icons I use and I think the issue lies with the stores but none of my stores are set on autoload.

非常感谢任何帮助.谢谢你.

Any help is very much appreciated. Thank you.

推荐答案

我不久前遇到了这个错误.这是由 Ext.Loader 加载动态扩展类.

I had this error a while a ago. It is caused by Ext.Loader which loads the Ext classes dynamically.

我可以通过在我的应用程序(即 app.js)的主 js 文件中的 Ext.require([...]) 语句中添加所需的类来解决它.

I could solve it by adding the required classes in the Ext.require([...]) statement in the main js file of my application (i.e. app.js).

Ext.Loader 的文档 说明何时以及为何发生异步和同步加载.

The docs for Ext.Loader explain when and why asynchronous and synchronous loading happens.

相关文章