Safari: new storage now works; closes #985

This commit is contained in:
Chris 2015-03-11 00:03:54 -06:00
parent 4720ecdf58
commit 10f656f8fe
1 changed files with 13 additions and 21 deletions

View File

@ -137,43 +137,35 @@
}
for(var i = 0; i < n; i++) {
var key = keys[i];
localforage.getItem(key, function(err, value) {
var func = function(err, value) {
toSatisfy--;
if(typeof value === "string") {
result[key] = JSON.parse(value);
result[arguments.callee.myKey] = JSON.parse(value);
}
if(toSatisfy === 0) {
callback(result);
}
});
};
func.myKey = key;
localforage.getItem(key, func);
}
}
else if(typeof keys === "object") {
var toSatisfy = 0;
for(var key in keys) {
if(!keys.hasOwnProperty(key)) {
continue;
}
toSatisfy++;
result[key] = keys[key];
}
for(var key in keys) {
if(!keys.hasOwnProperty(key)) {
continue;
}
var i = key;
localforage.getItem(i, function(err, value) {
localforage.iterate(function(value, key) {
if(!keys[key]) return;
if(typeof value === "string") {
result[i] = JSON.parse(value);
result[key] = JSON.parse(value);
}
else {
result[i] = keys[i];
}
if(--toSatisfy === 0) {
}, function() {
callback(result);
}
});
}
}
},
set: function(details, callback) {