diff options
author | hwc487 | 2012-05-31 17:11:08 -0700 |
---|---|---|
committer | hwc487 | 2012-05-31 17:11:08 -0700 |
commit | 1c445cf5d905f79937998cf2f1115594ea8c1074 (patch) | |
tree | 35271ad7ffec86fde9102af3dd954fa3a2974582 /js/components/converter | |
parent | 335ce503996e3ccbd2909086328d0a31fbd03370 (diff) | |
parent | 6042bdc5f2aada4412912fd01602d32c9088dc26 (diff) | |
download | ninja-1c445cf5d905f79937998cf2f1115594ea8c1074.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
js/io/system/ninjalibrary.json
Diffstat (limited to 'js/components/converter')
-rw-r--r-- | js/components/converter/string-units-converter.js | 31 | ||||
-rw-r--r-- | js/components/converter/string-value-converter.js | 29 |
2 files changed, 60 insertions, 0 deletions
diff --git a/js/components/converter/string-units-converter.js b/js/components/converter/string-units-converter.js new file mode 100644 index 00000000..6b97d5c5 --- /dev/null +++ b/js/components/converter/string-units-converter.js | |||
@@ -0,0 +1,31 @@ | |||
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 | var Montage = require("montage").Montage, | ||
7 | Converter = require("montage/core/converter/converter").Converter, | ||
8 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
9 | |||
10 | exports.StringUnitsConverter = Montage.create(Converter, { | ||
11 | |||
12 | // convert fahrenheit to celsius (showing our non-metric heritage here) | ||
13 | convert: { | ||
14 | value: function(value) { | ||
15 | if(value) { | ||
16 | console.log("convert string to unit ", value); | ||
17 | var tmp = NJUtils.getValueAndUnits(value); | ||
18 | return tmp[1]; | ||
19 | } | ||
20 | } | ||
21 | }, | ||
22 | |||
23 | // revert celsius to fahrenheit | ||
24 | revert: { | ||
25 | value: function(value) { | ||
26 | console.log("revert string to unit ", value); | ||
27 | return value; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | }); | ||
diff --git a/js/components/converter/string-value-converter.js b/js/components/converter/string-value-converter.js new file mode 100644 index 00000000..28d7dd29 --- /dev/null +++ b/js/components/converter/string-value-converter.js | |||
@@ -0,0 +1,29 @@ | |||
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 | var Montage = require("montage").Montage, | ||
7 | Converter = require("montage/core/converter/converter").Converter, | ||
8 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
9 | |||
10 | exports.StringValueConverter = Montage.create(Converter, { | ||
11 | |||
12 | // convert fahrenheit to celsius (showing our non-metric heritage here) | ||
13 | convert: { | ||
14 | value: function(value) { | ||
15 | console.log(value); | ||
16 | console.log(parseInt(value)); | ||
17 | return parseInt(value); | ||
18 | } | ||
19 | }, | ||
20 | |||
21 | // revert celsius to fahrenheit | ||
22 | revert: { | ||
23 | value: function(value) { | ||
24 | console.log("revert string to value ", value); | ||
25 | return value; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | }); | ||