diff options
author | Pierre Frisch | 2011-12-22 07:25:50 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-01-27 11:18:17 -0800 |
commit | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch) | |
tree | 0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /node_modules/montage/ui/loader.reel/loader.js | |
parent | 2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff) | |
download | ninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz |
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/loader.reel/loader.js')
-rwxr-xr-x | node_modules/montage/ui/loader.reel/loader.js | 472 |
1 files changed, 472 insertions, 0 deletions
diff --git a/node_modules/montage/ui/loader.reel/loader.js b/node_modules/montage/ui/loader.reel/loader.js new file mode 100755 index 00000000..3809d334 --- /dev/null +++ b/node_modules/montage/ui/loader.reel/loader.js | |||
@@ -0,0 +1,472 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | /** | ||
8 | @module montage/ui/loader | ||
9 | */ | ||
10 | |||
11 | var Montage = require("core/core").Montage, | ||
12 | Component = require("ui/component").Component, | ||
13 | logger = require("core/logger").logger("loader"), | ||
14 | bootstrappingTimeoutPropertyName = "_montageStartBootstrappingTimeout", | ||
15 | MONTAGE_BOOTSTRAPPER_ELEMENT_ID = "montage-app-bootstrapper", | ||
16 | MONTAGE_LOADER_ELEMENT_ID = "montage-app-loader", | ||
17 | BOOTSTRAPPING_CLASS_NAME = "montage-app-bootstrapping", | ||
18 | LOADING_CLASS_NAME = "montage-app-loading", | ||
19 | LOADED_CLASS_NAME = "montage-app-loaded", | ||
20 | PRELOADING = 0, | ||
21 | BOOTSTRAPPING = 1, | ||
22 | LOADING = 2, | ||
23 | LOADED = 3; | ||
24 | |||
25 | /** | ||
26 | @class module:montage/ui/loader.Loader | ||
27 | @extends module:montage/ui/component.Component | ||
28 | */ | ||
29 | |||
30 | exports.Loader = Montage.create(Component, /** @lends module:montage/ui/loader.Loader# */ { | ||
31 | |||
32 | // Configuration Properties | ||
33 | |||
34 | /** | ||
35 | The main module to require | ||
36 | */ | ||
37 | mainModule: { | ||
38 | enumerable: false, | ||
39 | value: "main.reel" | ||
40 | }, | ||
41 | |||
42 | /** | ||
43 | The name of the object to read from the mainModule exports | ||
44 | */ | ||
45 | mainName: { | ||
46 | enumerable: false, | ||
47 | value: "Main" | ||
48 | }, | ||
49 | |||
50 | /** | ||
51 | Whether or not to include framework modules in the collection of required and initialized modules | ||
52 | */ | ||
53 | includeFrameworkModules: { | ||
54 | enumerable: false, | ||
55 | value: false | ||
56 | }, | ||
57 | |||
58 | /** | ||
59 | The minimum amount of time the bootstrapping indicator must be shown for | ||
60 | */ | ||
61 | minimumBootstrappingDuration: { | ||
62 | enumerable: false, | ||
63 | value: 1500 | ||
64 | }, | ||
65 | |||
66 | /** | ||
67 | The minimum amount of time the loading indicator must be shown for | ||
68 | */ | ||
69 | minimumLoadingDuration: { | ||
70 | enumerable: false, | ||
71 | value: 2000 | ||
72 | }, | ||
73 | |||
74 | _initializedModules: { | ||
75 | enumerable: false, | ||
76 | value: null | ||
77 | }, | ||
78 | |||
79 | /** | ||
80 | The initialized modules...FIXME | ||
81 | */ | ||
82 | initializedModules: { | ||
83 | dependencies: ["includeFrameworkModules"], | ||
84 | enumerable: false, | ||
85 | get: function() { | ||
86 | if (!this._initializedModules || this.includeFrameworkModules) { | ||
87 | return this._initializedModules; | ||
88 | } else { | ||
89 | return this._initializedModules.slice(this._frameworkModuleCount - 1); | ||
90 | } | ||
91 | }, | ||
92 | set: function(value) { | ||
93 | this._initializedModules = value; | ||
94 | } | ||
95 | }, | ||
96 | |||
97 | _requiredModules: { | ||
98 | enumerable: false, | ||
99 | value: null | ||
100 | }, | ||
101 | |||
102 | /** | ||
103 | The required modules for this application ... FIXME | ||
104 | */ | ||
105 | requiredModules: { | ||
106 | dependencies: ["includeFrameworkModules"], | ||
107 | enumerable: false, | ||
108 | get: function() { | ||
109 | if (!this._requiredModules || this.includeFrameworkModules) { | ||
110 | return this._requiredModules; | ||
111 | } else { | ||
112 | return this._requiredModules.slice(this._frameworkModuleCount - 1); | ||
113 | } | ||
114 | }, | ||
115 | set: function(value) { | ||
116 | this._requiredModules = value; | ||
117 | } | ||
118 | }, | ||
119 | |||
120 | // States | ||
121 | |||
122 | _currentStage: { | ||
123 | enumerable: false, | ||
124 | value: PRELOADING | ||
125 | }, | ||
126 | |||
127 | /** | ||
128 | Current loading stage. | ||
129 | */ | ||
130 | currentStage: { | ||
131 | enumerable: false, | ||
132 | get: function() { | ||
133 | return this._currentStage; | ||
134 | }, | ||
135 | set: function(value) { | ||
136 | if (value === this._currentStage) { | ||
137 | return; | ||
138 | } | ||
139 | |||
140 | if (logger.isDebug) { | ||
141 | logger.debug(this, "CURRENT STAGE: " + value); | ||
142 | } | ||
143 | this._currentStage = value; | ||
144 | this.needsDraw = true; | ||
145 | } | ||
146 | }, | ||
147 | |||
148 | _readyToShowLoader: { | ||
149 | enumerable: false, | ||
150 | value: false | ||
151 | }, | ||
152 | |||
153 | /** | ||
154 | Boolean that specifies whether the loader is loading the application's main component. | ||
155 | */ | ||
156 | isLoadingMainComponent: { | ||
157 | enumerable: false, | ||
158 | value: null | ||
159 | }, | ||
160 | |||
161 | /** | ||
162 | Specifies whether the loader is ready to show the loading graphic...FIXME | ||
163 | */ | ||
164 | readyToShowLoader: { | ||
165 | enumerable: false, | ||
166 | get: function() { | ||
167 | return this._readyToShowLoader; | ||
168 | }, | ||
169 | set: function(value) { | ||
170 | if (value !== this._readyToShowLoader) { | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | this._readyToShowLoader = value; | ||
175 | this.needsDraw = true; | ||
176 | } | ||
177 | }, | ||
178 | |||
179 | /** | ||
180 | Specifies whether the main component is ready to be displayed. | ||
181 | */ | ||
182 | readyToShowMainComponent: { | ||
183 | enumerable: false, | ||
184 | get: function() { | ||
185 | return !!this._mainComponent; | ||
186 | } | ||
187 | }, | ||
188 | |||
189 | // Internal Properties | ||
190 | |||
191 | _frameworkModuleCount: { | ||
192 | enumerable: false, | ||
193 | value: null | ||
194 | }, | ||
195 | |||
196 | hasTemplate: { | ||
197 | enumerable: false, | ||
198 | value: false | ||
199 | }, | ||
200 | |||
201 | _mainComponent: { | ||
202 | enumerable: false, | ||
203 | value: null | ||
204 | }, | ||
205 | |||
206 | _showLoadingTimeout: { | ||
207 | enumerable: false, | ||
208 | value: null | ||
209 | }, | ||
210 | |||
211 | _showMainComponentTimeout: { | ||
212 | enumerable: false, | ||
213 | value: null | ||
214 | }, | ||
215 | |||
216 | // Implementation | ||
217 | |||
218 | templateDidLoad: { | ||
219 | value: function() { | ||
220 | |||
221 | if (logger.isDebug) { | ||
222 | logger.debug(this, "templateDidLoad"); | ||
223 | } | ||
224 | |||
225 | this.element = document.documentElement; | ||
226 | this.readyToShowLoader = true; | ||
227 | |||
228 | var timing = document._montageTiming, | ||
229 | remainingBootstrappingDelay, | ||