2
2
* ModulePattern Bootstrap
3
3
*
4
4
* Created : 21/01/2013
5
- * Modified : 27/08/2014
6
- * Version : 3.0
5
+ * Modified : 13/12/2015
6
+ * Version : 0.0.4
7
7
* UI Developer : Guilherme Pontes
8
8
* Notes : Copy and reproduce as much as you want.
9
9
---------------------------------------------------------------------------*/
10
10
11
11
/**
12
12
* This is MyApp, it makes something awesome.
13
- * It's an self invokated function that runs automatically/immediately.
13
+ * It's a self invokated function that runs automatically/immediately.
14
14
*
15
15
* @class MyApp
16
16
* @constructor
17
17
*/
18
18
var MyApp = window . MyApp || ( function ( document , window ) {
19
19
"use strict" ;
20
20
21
- var app , _private ;
22
-
23
21
/**
24
22
* The _private variable encapsulate all PRIVATE functions
25
23
* and properties.
@@ -28,7 +26,7 @@ var MyApp = window.MyApp || (function(document, window){
28
26
* @type {Object }
29
27
* @default {Object}
30
28
*/
31
- _private = {
29
+ var __private = {
32
30
/**
33
31
* The _config variable sets all properties that will be
34
32
* handled by the app.
@@ -58,7 +56,7 @@ var MyApp = window.MyApp || (function(document, window){
58
56
} ,
59
57
60
58
/**
61
- * Makes the body element from { MyApp.body} the color setted,
59
+ * Makes the body element from ` MyApp.body` the color setted,
62
60
* if not setted it will be the default color
63
61
* from {_private._config.background.color}
64
62
*
@@ -67,45 +65,45 @@ var MyApp = window.MyApp || (function(document, window){
67
65
* @return {Undefined }
68
66
*/
69
67
setBGColor : function ( color ) {
70
- app . body . style . background = color || this . _config . background . color ;
68
+ application . body . style . background = color || this . _config . background . color ;
71
69
} ,
72
70
73
71
/**
74
- * Makes body blue from { MyApp.init} method.
72
+ * Makes body blue from ` MyApp.init` method.
75
73
*
76
74
* @method makeBackgroundBlue
77
75
* @return {Undefined }
78
76
*/
79
77
makeBackgroundBlue : function ( ) {
80
- _private . setBGColor ( "blue" ) ;
78
+ __private . setBGColor ( "blue" ) ;
81
79
} ,
82
80
83
81
/**
84
- * Makes body red from click event at { MyApp.bind} from
82
+ * Makes body red from click event at ` MyApp.bind` from
85
83
* {MyApp.makeBodyRed}.
86
84
*
87
85
* @method makeBackgroundRed
88
86
* @return {Undefined }
89
87
*/
90
88
makeBackgroundRed : function ( ) {
91
- _private . setBGColor ( "red" ) ;
89
+ __private . setBGColor ( "red" ) ;
92
90
}
93
91
} ;
94
92
95
93
/**
96
- * The _app variable encapsulate all PUBLIC functions
94
+ * Encapsulates all PUBLIC functions
97
95
* and properties.
98
96
*
99
97
* @property _private
100
98
* @type {Object }
101
99
* @default {Object}
102
100
*/
103
- app = {
101
+ var application = {
104
102
105
103
/**
106
- * The init method, is the function that initialize the project,
107
- * by caching variables and binding objects and can initialize
108
- * other methods too .
104
+ * Initialize the project by caching variables
105
+ * and binding the objects. It can also initialize
106
+ * other methods.
109
107
*
110
108
* @method init
111
109
* @return {Undefined }
@@ -114,15 +112,13 @@ var MyApp = window.MyApp || (function(document, window){
114
112
this . _cache ( ) ;
115
113
this . _bind ( ) ;
116
114
117
- //the background must be blue first..
118
115
_private . makeBackgroundBlue ( ) ;
119
116
} ,
120
117
121
118
/**
122
- * The _cache method creates public properties that will be
123
- * handled by other methods. Caching elements to not have to be
124
- * called every single time.
125
- *
119
+ * Creates public properties that will be
120
+ * handled by other methods. Caching elements is a
121
+ * good practice.
126
122
*
127
123
* @method _cache
128
124
* @return {Undefined }
@@ -132,7 +128,7 @@ var MyApp = window.MyApp || (function(document, window){
132
128
} ,
133
129
134
130
/**
135
- * The _bind method bind all cached dom elements from { MyApp._cache} .
131
+ * Bind all cached dom elements from ` MyApp._cache` .
136
132
* It sets methods to events made by the DOM.
137
133
*
138
134
*
@@ -145,13 +141,11 @@ var MyApp = window.MyApp || (function(document, window){
145
141
} ;
146
142
147
143
// make app visible by the MyApp;
148
- return app ;
144
+ return application ;
149
145
150
146
} ) ( document , window ) ;
151
- //We also could auto-initialize the app this way, adding a `.init()`, like this:
147
+ //We also can auto-initialize the app by adding a `.init()`, like this:
152
148
//})(document, window).init();
153
149
154
- // another self invokated function to executes the app.
155
- ( function ( ) {
156
- MyApp . init ( ) ;
157
- } ) ( ) ;
150
+ // Initialize app
151
+ MyApp . init ( ) ;
0 commit comments