PDA

View Full Version : Is Ext.require guaranteed to finish before onReady is called?



SergiuB
15 Jan 2013, 5:27 AM
We use ext-debug.js and specify all the dependencies upfront using Ext.require, right above the Application launch function.



Ext.require([
..., // many dependencies
'Ext.data.reader.Json'
]);


Ext.application({
launch: function () {
....
}
});


Even though 'Ext.data.reader.Json' is specified in require call, I see the browser warning:
[Ext.Loader] Synchronously loading 'Ext.data.reader.Json'; consider adding Ext.require('Ext.data.reader.Json') above Ext.onReady

According to docs these warnings should go away if you specifically require the js files.

So I assume this is a synchronization issue due to the async nature of the require call, which sometimes does not complete before the launch/onReady methods start executing, is this correct?
If I use syncRequire instead of require there is no warning.

mitchellsimoens
17 Jan 2013, 8:59 AM
It will load before Ext.onReady/Ext.application#launch fires. This would tell me you are doing something else in a class definition that is creating a Json reader

SergiuB
17 Jan 2013, 9:24 AM
Thanks a lot Mitchell
Indeed I was requiring some stores who use Json reader before the Json reader definition itself.
I changed the order in the require call, and everything is fine.