From the course: JavaScript: Client-Side Data Storage
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Overview of localForage - JavaScript Tutorial
From the course: JavaScript: Client-Side Data Storage
Overview of localForage
- localForage is a local storage API that allows you to save many types of data such as strings, numbers, arrays, objects and more. It's an option over using Web Storage or IndexedDB and it has a simpler API. It also allows us to do asynchronous and supports Promises. Therefore, you can fully take advantage of Promises when you use the API's methods. Getting, adding, updating and removing items are fairly similar to how we did it in local and session storage. And now with the possibility of doing call backs with Promises, let me show you a few examples. If you scroll down to installation, you'll see that after a brief installation, it's fairly easy to get set up. And then you have examples for getting items. So, for example, if you do localforage then getitems and then somekey, then you can basically get the information and then use Promises to, for example, catch if there's an error or even do something else with what the results bring back. The same thing with setitems. So as you…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.