fixed bug where if toJSON is called before keys, it threw an error
This commit is contained in:
parent
16fb1c730e
commit
a704e4ad02
@ -75,6 +75,7 @@
|
|||||||
|
|
||||||
this._store = w3cStorage;
|
this._store = w3cStorage;
|
||||||
this._keysAreDirty = true;
|
this._keysAreDirty = true;
|
||||||
|
this._keys = [];
|
||||||
if (!this._store.getItem('_json-storage-namespaced_')) {
|
if (!this._store.getItem('_json-storage-namespaced_')) {
|
||||||
upgradeStorage(this, w3cStorage);
|
upgradeStorage(this, w3cStorage);
|
||||||
}
|
}
|
||||||
@ -135,7 +136,7 @@
|
|||||||
var json = {}
|
var json = {}
|
||||||
;
|
;
|
||||||
|
|
||||||
this._keys.forEach(function (key) {
|
this.keys().forEach(function (key) {
|
||||||
json[key] = this.get(key);
|
json[key] = this.get(key);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "json-storage",
|
"name": "json-storage",
|
||||||
"description": "A wrapper for storage engines which use the W3C Storage API",
|
"description": "A wrapper for storage engines which use the W3C Storage API",
|
||||||
"keywords": ["ender", "localStorage", "sessionStorage", "globalStorage", "Storage"],
|
"keywords": ["ender", "localStorage", "sessionStorage", "globalStorage", "Storage"],
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/coolaj86/json-storage-js.git"
|
"url": "git://github.com/coolaj86/json-storage-js.git"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user