Commit c49841e6 authored by ben hockey's avatar ben hockey

reference json module rather than dojo global

parent 90878227
/** /**
* Original source from https://gist.github.com/880822 * Original source from https://gist.github.com/880822
* Converted to AMD-baseless format * Converted to AMD-baseless format
*/ */
define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/util/QueryResults", "dojo/store/util/SimpleQueryEngine"], define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/util/QueryResults", "dojo/store/util/SimpleQueryEngine"],
...@@ -53,7 +53,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/ ...@@ -53,7 +53,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/
// property if a specific id is to be used. // property if a specific id is to be used.
// returns: Number // returns: Number
var id = options && options.id || object[this.idProperty] || Math.random(); var id = options && options.id || object[this.idProperty] || Math.random();
localStorage.setItem(id,dojo.toJson(object)); localStorage.setItem(id, json.toJson(object));
return id; return id;
}, },
add: function(object, options){ add: function(object, options){
...@@ -112,7 +112,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/ ...@@ -112,7 +112,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dojo/_base/json", "dojo/store/
var data=[]; var data=[];
for (var i=0; i<localStorage.length;i++){ for (var i=0; i<localStorage.length;i++){
data.push(this.get(localStorage.key(i))); data.push(this.get(localStorage.key(i)));
} }
return QueryResults(this.queryEngine(query, options)(data)); return QueryResults(this.queryEngine(query, options)(data));
}, },
setData: function(data){ setData: function(data){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment