Table of Content
Refractoring the LocalStorage module
We are going to treat the tags as data instead of string. Before that, we will refractor the storage as an individual module inside data object.
Note: we used .call(data)
so the this
inside that annonymous function refers to the data
object.
When we load the books list:
1data.books = data.storage.loadList("books");
When we need to save the book list, we call the following:
1this.storage.saveList("books", this.books);
What’s next? We’re going to take a look at “Planning the tags data structure”.