1 /* Copyright 2011 The Dominion of Awesome
2 * See COPYING for licensing information */
8 this.inherited(arguments);
10 var str = localStorage['hacks/' + this.kind];
12 this.setPreferences(JSON.parse(str), true, true);
14 enyo.log("Could not load preferences: " + e.toString());
25 getPreferencesMetadata: function() {
26 return this.preferences;
28 getPreferences: function() {
30 for (var i = 0; i < this.preferences.length; i++) {
31 var p = this.preferences[i];
32 o[p.name] = this[p.name];
36 setPreferences: function(prefs, nosave, nonotify) {
37 for (var i in prefs) {
38 if (this[i] == undefined)
39 throw new Error('Cannot set nonexistent preference "' + i + '"');
43 this.savePreferences();
45 this.preferencesChanged();
47 savePreferences: function() {
49 localStorage['hacks/' + this.kind] = JSON.stringify(this.getPreferences());
51 enyo.log("Could not save prefs: " + e.toString());
54 preferencesChanged: function() { }