diff options
author | Valerio Virgillito | 2012-02-27 10:51:15 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-27 10:51:15 -0800 |
commit | da60be29baab67440535b6b2b71fe7de989dfed0 (patch) | |
tree | 3cda434387f2aa6744808b2b0b4e7571d6d3a467 /js/data | |
parent | a5d635a29de97a7daa93b9036d7a7dce48f07670 (diff) | |
parent | 72baf1c366829ada6858097dd7553ee9988d6110 (diff) | |
download | ninja-da60be29baab67440535b6b2b71fe7de989dfed0.tar.gz |
Merge branch 'local-storage-version' of https://github.com/mencio/ninja-internal into integration-candidate
Diffstat (limited to 'js/data')
-rwxr-xr-x | js/data/settings.js | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/js/data/settings.js b/js/data/settings.js deleted file mode 100755 index ffea2075..00000000 --- a/js/data/settings.js +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
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 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | LocalStorage = require("js/controllers/local-storage-controller").LocalStorage; | ||
10 | |||
11 | exports.Settings = Montage.create( Component, { | ||
12 | |||
13 | version: { | ||
14 | value: "11.1213" | ||
15 | }, | ||
16 | |||
17 | _settings: { | ||
18 | value: null | ||
19 | }, | ||
20 | |||
21 | settings: { | ||
22 | get: function() { return this._settings; }, | ||
23 | set: function(value) { this._settings = value; } | ||
24 | }, | ||
25 | |||
26 | getSetting: { | ||
27 | value: function(objName, fieldName, namespace) { | ||
28 | try { | ||
29 | objName = objName.replace(/-/gi, "_").replace(/\//gi, "zzSlash"); | ||
30 | return this.settings[objName][fieldName]; | ||
31 | } catch(e) { | ||
32 | return null; | ||
33 | } | ||
34 | } | ||
35 | }, | ||
36 | |||
37 | setSetting: { | ||
38 | value: function(objName, fieldName, value, namespace) { | ||
39 | try { | ||
40 | objName = objName.replace(/-/gi, "_").replace(/\//gi, "zzSlash"); | ||
41 | |||
42 | if(this.settings === null) { | ||
43 | this.settings = {}; | ||
44 | } | ||
45 | |||
46 | if (this.settings[objName] == null) { | ||
47 | this.settings[objName] = {}; | ||
48 | } | ||
49 | |||
50 | this.settings[objName][fieldName] = value; | ||
51 | |||
52 | LocalStorage.setItem("settings", this.settings); | ||
53 | } catch(e) { | ||
54 | return null; | ||
55 | } | ||
56 | } | ||
57 | }, | ||
58 | |||
59 | deserializedFromSerialization: { | ||
60 | value: function() { | ||
61 | |||
62 | if (LocalStorage.getItem("version") != this.version) { | ||
63 | this.settings = {} | ||
64 | LocalStorage.setItem("version",this.version); | ||
65 | } else { | ||
66 | this.settings = LocalStorage.getItem("settings"); | ||
67 | } | ||
68 | |||
69 | } | ||
70 | } | ||
71 | }); \ No newline at end of file | ||