Reputation: 11791
All, I am a noob in Backbone, The question I asked maybe is easy for you .
Recently I began to learn it from some basic tutorials, I found many demos mentions the localstorage
which I can't understand .
Say we have some code like this.
window.EmployeeList = Backbone.Collection.extend({
model : Employee,
localStorage: new Store("employees")
});
Can anyone help to tell me where is the data employee
stored in ? What is the localStorage
? thanks.
Upvotes: 0
Views: 403
Reputation: 5079
The localStorage is a small database built into the browser. Usually it is for small Data <5MB
You can think of it as a better form of a cookie. You can create stores like your "employees" store and save data to it like a normal database.
This should improve performance and capabilities of modern web applications. For example google mail uses this localstorage to keep a local copy of your inbox in case your client is offline (no network on mobile devices)
You can inspect the localstorage e.g. in google chrome by F12 -> Resources -> LocalStorage
Upvotes: 2