PDA

View Full Version : Ext.require vs Ext.class.requires



FPXdeveloper_4
28 Nov 2011, 6:50 AM
It has been said often in here that the SDK tools need files to use the "uses" or "require" statements. Can we also use the Ext.class.requires array? http://docs.sencha.com/ext-js/4-0/#!/api/Ext.Class-cfg-requires

I have preferred using these over the Ext.require statement. It seems cleaner. Do I need to switch to using Ext.require?

mitchellsimoens
28 Nov 2011, 6:57 AM
You should definitely use the requires/uses throughout your application files. This tells the SDK tools what order to build the jsb3 file. Placing classes in the requires property says that those classes need to be defined before this class is defined. uses says that those classes need to be defined before this class is instantiated.

FPXdeveloper_4
28 Nov 2011, 7:22 AM
Thanks for the reply. Now given that I am using Ext.class.requires, do I also need to use Ext.require?

mitchellsimoens
28 Nov 2011, 7:27 AM
Thanks for the reply. Now given that I am using Ext.class.requires, do I also need to use Ext.require?

I only use it if I want to bulk load things... like 'Ext.chart.*' but if you have things setup throughout your application, you probably don't really need it.

DocAhrens
29 Mar 2012, 9:41 AM
Placing classes in the 'requires' property says that those classes need to be defined before this class is defined. 'uses' says that those classes need to be defined before this class is instantiated.
With 'requires' vs 'uses', is there a difference in when the files are loaded or are there performance implications of using 'requires' over 'uses' or vice versa? Should we be using 'uses' most of the time and only use 'requires' when 'uses' isn't enough?