ExtJS 4.2 - “同步XMLHttpRequest”的可能原因警告? [英] ExtJS 4.2 - Possible causes of a "Sychronous XMLHttpRequest" warning?

查看:165
本文介绍了ExtJS 4.2 - “同步XMLHttpRequest”的可能原因警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的一天,对于看似广泛的问题标题感到遗憾。



我正在使用php和sql为用户数据构建一个ExtJS4应用程序。一切都进行到一天,我注意到这个错误在我的java控制台:

 主线程上的同步XMLHttpRequest被弃用,因为对最终用户的经验有不利影响。 
有关更多帮助,请访问http://xhr.spec.whatwg.org/。

最初,我没有这么麻烦,因为我的应用程序加载相当不错,而在我的本地网络。但是,一旦我上传到在线服务器并对其进行了测试,应用程序加载速度非常慢,有时甚至无法加载。



我不记得在我的应用程序中的任何地方调用XMLHttpRequest,所以我突然发现了如何或为什么我突然得到这个警告。 p>

我连接到我的数据库并返回的唯一方法是通过商店。



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



任何帮助是非常感谢谢谢。

解决方案

之前我有这个错误。这是由 Ext.Loader 引起的,它加载动态分类。



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



docs解释何时和为什么异步和同步加载发生。


Good day, sorry for the seemingly broad question title.

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.

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.

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

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.

解决方案

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

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).

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

这篇关于ExtJS 4.2 - “同步XMLHttpRequest”的可能原因警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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