Reputation: 8041
Consider this,
MyApp = Ember.Application.create();
MyApp.someName = Ember.Namespace.create({
//my properties
});
I can do the same this using Ember.Object
either...
MyApp = Ember.Application.create();
MyApp.someName = Ember.Object.create({
//my properties
});
So, when should I use Namespace
? Where is the difference ?
Upvotes: 2
Views: 485
Reputation: 10726
You can look the Namespace documentation:
A Namespace is an object usually used to contain other objects or methods such as an application or framework. Create a namespace anytime you want to define one of these new containers.
And the difference with an object is the destroy
method, which remove the namespace from the namespaces list, as you can see here:
destroy: function() {
var namespaces = Ember.Namespace.NAMESPACES;
window[this.toString()] = undefined;
namespaces.splice(indexOf.call(namespaces, this), 1);
this._super();
}
Upvotes: 1