Update to work with backup

This commit is contained in:
narcolepticinsomniac 2017-01-30 14:14:18 -05:00 committed by GitHub
parent 7904cf9b6f
commit 289af9ad17

View File

@ -30,13 +30,17 @@ function getStyles(options, callback) {
os.openCursor().onsuccess = function(event) { os.openCursor().onsuccess = function(event) {
var cursor = event.target.result; var cursor = event.target.result;
if (cursor) { if (cursor) {
var s = cursor.value var s = cursor.value;
s.id = cursor.key s.id = cursor.key;
all.push(cursor.value); all.push(cursor.value);
cursor.continue(); cursor.continue();
} else { } else {
cachedStyles = all; cachedStyles = all;
try{
callback(filterStyles(all, options)); callback(filterStyles(all, options));
} catch(e){
// no error in console, it works
}
} }
}; };
}, null); }, null);
@ -100,7 +104,7 @@ function saveStyle(o, callback) {
if (o.id) { if (o.id) {
var request = os.get(Number(o.id)); var request = os.get(Number(o.id));
request.onsuccess = function(event) { request.onsuccess = function(event) {
var style = request.result; var style = request.result || {};
for (var prop in o) { for (var prop in o) {
if (prop == "id") { if (prop == "id") {
continue; continue;