Unfortunately I rely on things like Object.keys(localStorage) to give me the keys of all items stored.
var isolated = new MemoryStorage('my-app');
isolated.setItem("test", JSON.stringify({ key: "value" }));
Object.keys(isolated);
/// returns ["id", "length", "getItem", "setItem", "removeItem", "key", "clear", "test"]
localStorage.setItem("test", JSON.stringify({ key: "value" }));
Object.keys(localStorage);
/// returns ["test"]
It might be related, also that the output of applying JSON.stringify is not compatile to localStorage. It should be
JSON.stringify(localStorage)
// returns {"test":"{\"key\":\"value\"}"}
but instead it is
JSON.stringify(isolated)
// returns {"id":"my-app","length":1,"test":"{\"key\":\"value\"}"}
Perhaps one should define a .toJSON method to fix that behaviour.
With best regards
Semmel
Unfortunately I rely on things like
Object.keys(localStorage)to give me the keys of all items stored.It might be related, also that the output of applying
JSON.stringifyis not compatile to localStorage. It should bebut instead it is
Perhaps one should define a
.toJSONmethod to fix that behaviour.With best regards
Semmel