HTML and CSS Reference
5.2.1. Reading data from localStorage
When the application starts, it will need to read the user's name and chosen color scheme
from some client-based data store, then apply them to the UI. You'll use localStorage
as a repository for this information and store each piece of data as a key/value pair. Retriev-
ing items from localStorage is done by calling its Storage API method getItem with
the value's key.
Step 1: Reading application settings from localStorage
For the purpose of retrieving application settings from localStorage , the application
will need a loadSettings function. This function reads the user's name and color
scheme from localStorage using the Web Storage API method getItem and then
adjusts the navigation bar's header to include the user's name, and changes the document
element's class attribute to assign the selected color scheme.
Open the app.js file you created earlier in the chapter, and add the code from the next listing
to the Tasks constructor function (just below the line where you attach a handler to the