PDA

View Full Version : Singleton classes declared through Ext.apply with an empty object



chinabuffet
18 Jan 2011, 7:57 AM
In the Ext JS source code, there are some instances of singleton classes being declared in the following fashion:



Ext.Loader = Ext.apply({}, {
...


Is there any advantage/reason for creating the declaration that way instead of just doing something like:



Ext.Loader = {
...


?

Condor
18 Jan 2011, 8:07 AM
I don't see any advantage...

Another option would be:

Ext.Loader = (Ext.extend(Object, {
...
}))();
(that way an Ext.Loader isn't an object)