1
0
Fork 0

Remove storage if empty data

This commit is contained in:
Dan Hromada 2014-05-12 11:35:25 +02:00
parent 223bacc6e6
commit bd2d6f52c2

View file

@ -96,6 +96,21 @@
var str = JSON.stringify(this.data || {});
localStorage.setItem(this.key, str);
},
remove: function(key) {
if( key ) {
delete this.data[key];
if( $.isEmptyObject(this.data) ) {
this.remove();
}
else {
var str = JSON.stringify(this.data || {});
localStorage.setItem(this.key, str);
}
}
else {
localStorage.removeItem(this.key);
}
}
},
apiclb: {
@ -218,7 +233,7 @@
};
},
removeDraft: function() {
popup.storage.set('draft', null);
popup.storage.remove('draft', null);
popup.applyData();
popup.el.draftRemoveLink.addClass('is-hidden');
},