Is localstorage the right choice for this webapp?

一个人想着一个人 提交于 2019-12-03 18:17:49

问题


I'm interested in building a small offline webapp and I'm looking for some advice. Here's the basics of what I want it to do

  • Create reports that, initially, will just have a name and text field
  • List, edit, and delete these notes
  • Ideally I'd like to add more fields to the reports later

Is localstorage a good option for storing this type of data locally? If so, can anybody direct me to a complete list of the commands for interacting with it in javascript? e.g. setItem, getItem, etc.

Thanks.


回答1:


localstorage will work just fine for this, but don't think of it as a robust solution.. It's just a basic key/value store and won't be very performant with thousands of complex things going on.

Check out the excellent Dive into HTML5 guide on localstorage: http://diveintohtml5.info/storage.html




回答2:


Link to the localstorage apis

Yes localstorage would be perfect for you application. It would allow your application to have no need to connect to a server at all. Keep in mind that local storage does have maximums on the amount of data that can be stored.

EDIT: Using JSON.stringify() on can convert complex javascript objects to json which can be storage and retrieved with ease inside of local storage.



来源:https://stackoverflow.com/questions/11217313/is-localstorage-the-right-choice-for-this-webapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!