localStorage array of objects handling

后端 未结 3 744
野的像风
野的像风 2020-12-09 17:07

Array of JSON objects are stored in HTML5 localStorage.
For now delimiter is ;
For accessing and modifying array of object

3条回答
  •  醉梦人生
    2020-12-09 17:32

    You can use parse and stringify if the array isn't too big, but if it is, then you'll be re-encoding the whole data set for every little change.

    The library at http://rhaboo.org improves on that by giving each array entry its own localStorage entry in a linked list. That means you can make changes quite efficiently. Unlike JSON, it also honours text-named properties and three different types of sparse entry (null, undefined and simply not there.)

    BTW, I wrote rhaboo.

提交回复
热议问题