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.
Asked
Active
Viewed 179 times
2 Answers
1
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

Community
- 1
- 1

Boris Gappov
- 2,483
- 18
- 23
-
Broken second link :( – Robert Koritnik Oct 16 '13 at 13:00
-
Just find in google 'Javascript Namespace'. 1 result for example: http://javascriptweblog.wordpress.com/2010/12/07/namespacing-in-javascript/ – Boris Gappov Oct 16 '13 at 17:03
-
You should still update your answer if somebody tells you that your answer is no longer *competent*. – Robert Koritnik Oct 17 '13 at 05:30
1
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

dbrin
- 15,525
- 4
- 56
- 83
-
So Namespace was not what I expected, I have a controller with many lines of code, I just wanted to better organize this functionality by separating code, I thought that this was possible using namespace. For example, I have code that saves a student and a code that saves a teacher within the same controller, I wanted to better organize in different files. – Danilo M. Nov 27 '12 at 16:32
-
-
I want to have 2 controllers, but I would to call the functions in just one controller, do you understand what I want to do ? - 1 Controller to student functions - 1 controller to teacher functions and 1 controller to manage this functions. – Danilo M. Nov 28 '12 at 10:17
-
I am afraid I am not following your line of thinking. There are Architecture guides to MVC on the Sencha site - perhaps it would help following their suggested way of structuring your app. – dbrin Nov 28 '12 at 18:26