I came across to Ext.namespace()
in the project that I am working on.
I looked in Sencha's website and the explanation was not very helpful.
This is what they are saying:
Creates namespaces to be used for scoping variables and classes so that they are not global. Specifying the last node of a namespace implicitly creates all other nodes.
Ext.namespace('Company', 'Company.data');
They also mention that Ext.ns('Company.data')
is preferable.
I apologize if this question seems simple or dumb, but I really want to completely understand this concept. Thanks in advance
This is what is not very clear to me:
- If I have
Ext.namespace('Company', 'Company.data')
at the top of my JS page, does this mean that it carries all the other function name and variables (like a global scope)? - What exactly 'Company' and 'Company.data' stand for in
Ext.namespace('Company', 'Company.data')
? - Why new convention
Ext.ns('Company.data')
does not have 'Company' like inExt.namespace
? - What does this mean
Specifying the last node of a namespace implicitly creates all other nodes
? - When exactly this idea should be used?