On 17.12.12 21:35, Noit wrote:
So Im working hard to release an app but I cant use localStorage! Because data
is stored as a string, when i call it, back the data is still a string. I can't
use eval!! How can I use eval?
Man this app dev experience has been misreable.
From https://developer.mozilla.org/en-US/docs/DOM/Storage:
*Note:* Keep in mind that everything you store in any of the storages
described in this page is converted to string using its |.toString|
method before being stored. So trying to store a common object will
result in string |"[object Object]"| to be stored instead of the object
or its JSON representation. Using native JSON parsing and serialization
methods provided by the browser is a good and common way for storing
objects in string format.
AKA, please don't use eval, but use JSON to serialize and deserialize
your data.
Or better still, use indexedDB? I think that's the storage that most of
our apps use.
Axel
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g