A
A
Artem2015-11-20 10:47:00
JavaScript
Artem, 2015-11-20 10:47:00

Loading data from LocalStorage?

I'm learning javascript, specifically Backbone. I'm looking through the code of this application todomvc.com/examples/backbone
I can't figure out where in the code the data is loaded from LocalStorage. It seems like the "reset" event of the collection is being listened to. Does the collection's reset event fire when the page is reloaded? And another question, I didn’t understand in which part of the code the data is saved in LocalStorage

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
D', 2015-11-20
@Denormalization

It uses https://github.com/jeromegn/Backbone.localStorage
And the collection accordingly has a field:
Now the collection will work with localStorage, and the data will be taken and saved from there.

A
Artem, 2015-11-20
@Paramount1987

Does the collection's reset event fire when the page is reloaded?

M
MetaDone, 2015-11-20
@MetaDone

look for the line localStorage.getItem
for more details about local storage - htmlbook.ru/html5/storage
and after a quick look - work with local storage like here - https://github.com/tastejs/todomvc/blob/gh-pages/e.. .

E
Evgeny Petrov, 2015-11-20
@EvgenZZ

Mozilla has a localforage library, in some cases I use it. Look

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question