問題描述
美好的一天,對于看似寬泛的問題標題感到抱歉.
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.
這篇關于ExtJS 4.2 - “同步 XMLHttpRequest"的可能原因;警告?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!