Reputation: 1592
I wanna implement the Name Space concept in my JavaScript code, I am using ExtJS, but I don't know where to start, anyone could help me? The site example is very short.
Upvotes: 0
Views: 184
Reputation: 2493
Here is a good sample How do I declare a namespace in JavaScript?
and here is too https://developer.mozilla.org/en-US/docs/XUL/School_tutorial/JavaScript_Object_Management
Upvotes: 1
Reputation: 15673
Actually in ExtJS4 the App name is your name space. So for example if you define your app this way:
Ext.application({
name: 'MyApp',
appFolder: 'app',
autoCreateViewport: true,
controllers: [
'MyController'
],
launch: function() {
console.log('hello');
// This is fired as soon as the page is ready
}
});
then all of your components you define need to be namespaced with MyApp
. So a controller becomes MyApp.controller.MyController
and a view becomes MyApp.view.InboxGrid
Upvotes: 1