ported to Web SQL
[ReadingsJQM.git] / js / app / Config.js
index 87a99b7..19df0d1 100644 (file)
@@ -1,3 +1,4 @@
+// Generated by CoffeeScript 1.3.3
 (function() {
 
   Readings.Config = (function() {
@@ -6,10 +7,23 @@
       this.opts = opts;
     }
 
+    Config.prototype.key = function(name) {
+      return "config." + name;
+    };
+
     Config.prototype.get = function(name) {
+      var v;
+      v = localStorage.getItem(this.key(name));
+      if (v != null) {
+        return JSON.parse(v);
+      }
       return this.opts[name];
     };
 
+    Config.prototype.save = function(name, value) {
+      return localStorage.setItem(this.key(name), JSON.stringify(value));
+    };
+
     return Config;
 
   })();