diff options
author | Valerio Virgillito | 2012-01-30 16:35:59 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-01-31 10:10:15 -0800 |
commit | 4aac9e06107e9f8fa32f2dcd2f0addb382fc1f6c (patch) | |
tree | 687a5275f6a3d7540e3e1adf5ddcb24772cd2956 | |
parent | 6c346bb9459af800469ecfea8a61def0bad96c1a (diff) | |
download | ninja-4aac9e06107e9f8fa32f2dcd2f0addb382fc1f6c.tar.gz |
Adding a version json object to Ninja
Versions object to start keeping track of versions for Ninja, Montage and eventually other dependencies.
Loaded before montage to use in the splash screen.
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
-rw-r--r-- | index.html | 18 | ||||
-rw-r--r-- | js/ninja.reel/ninja.js | 1 | ||||
-rw-r--r-- | versions.json | 8 |
3 files changed, 26 insertions, 1 deletions
@@ -168,11 +168,27 @@ | |||
168 | 168 | ||
169 | <script type="text/javascript"> | 169 | <script type="text/javascript"> |
170 | window.onload = function() { | 170 | window.onload = function() { |
171 | // Load the version json | ||
172 | var req = new XMLHttpRequest(); | ||
173 | req.open("GET", "versions.json"); | ||
174 | req.onreadystatechange = (function(req) { | ||
175 | return function(event) { | ||
176 | if (req.readyState === 4) { | ||
177 | if (req.status === 200) { | ||
178 | window.ninjaVersion = JSON.parse(req.responseText); | ||
179 | } else { | ||
180 | console.log("Ninja version file could not be loaded"); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | })(req); | ||
185 | req.send(); | ||
171 | // | 186 | // |
172 | var star = document.getElementById('star'); | 187 | var star = document.getElementById('star'); |
173 | // | 188 | // |
174 | njstar(star.getContext("2d")); | 189 | njstar(star.getContext("2d")); |
175 | } | 190 | }; |
191 | |||
176 | function njstar (ctx) { | 192 | function njstar (ctx) { |
177 | ctx.save(); | 193 | ctx.save(); |
178 | ctx.translate(0,0); | 194 | ctx.translate(0,0); |
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index bc31e0e1..75ec7fcc 100644 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -36,6 +36,7 @@ exports.Ninja = Montage.create(Component, { | |||
36 | 36 | ||
37 | prepareForDraw: { | 37 | prepareForDraw: { |
38 | value: function() { | 38 | value: function() { |
39 | console.log("Loading Ninja --> ", window.ninjaVersion.ninja.version); | ||
39 | 40 | ||
40 | this.application.ninja = this; | 41 | this.application.ninja = this; |
41 | 42 | ||
diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..2d568314 --- /dev/null +++ b/versions.json | |||
@@ -0,0 +1,8 @@ | |||
1 | { | ||
2 | "ninja": { | ||
3 | "version": "0.5.0" | ||
4 | }, | ||
5 | "montage": { | ||
6 | "version": "0.5.1" | ||
7 | } | ||
8 | } \ No newline at end of file | ||