PDA

View Full Version : requires attribute



simon
8 May 2014, 6:13 AM
I have one simple question:


Ext.define('Packt.store.Menu', {
extend: 'Ext.data.Store',
requires: [
'Packt.model.menu.Root'
],
model: 'Packt.model.menu.Root',


When creating store, there is defined it's model property.
Why use also requires? As I understand, when model is defined, requires is not needed since it also includes requires?
What is the difference? If i remove requires, everything still works.

damo
8 May 2014, 7:29 AM
Correct, no need to use the requires for your example. Sencha CMD will include the model in the build.

The requires would be used if you have other code which the store depends on such as a singleton etc.