local-storagelocalforage

What is the difference between localForage and localStorage


As I was looking to add an offline mode to an application, I dumped into localForage, which seems to be an interesting way to do so.

Still, I didn't get the difference it has with a simple localStorage API. Can anyone help me with that ?


Solution

  • LocalStorage API is synchronous and accepts simple key value strings.

    LocalForage leverage this simple interface with Promises to get/set values and gives the ability to store more than converted strings as data.

    If you are familiar with the logic of LocalStorage and you are experimenting with something new I suggest you give it a try.

    Reference: http://blog.teamtreehouse.com/using-localforage-offline-data-storage