SMH110 / widgets

1 stars 0 forks source link

Save user preferences #45

Open massimocode opened 8 years ago

massimocode commented 8 years ago

I've noticed that if I add a few calculators and then reload the page, it goes back to only 1 calculator. If we are going to implement https://github.com/SMH110/My-Calculator/issues/44 then it would be helpful to store the user's preferences. This way, when the page loads, the previously selected widgets are shown.

There are 2 ways I can think of. 1) Cookies and 2) Local Storage.

I know that Google Chrome does not allow non-hosted files to set cookies (i.e. if you double click calculator.html to open it in Chrome so that it comes up as file://...../calculator.html, as opposed to having it on a local web server and accessing it via http://localhost), and also cookies don't have the nicest API, so I don't think that's a good idea.

But I think localStorage should work fine for this and a quick test tells me that it should work (at least in Chrome anyway!).

massimocode commented 8 years ago

I wanted to add that for our initial implementation, we should not store any of the items on the todo lists. We should also not store any of the information on any of the calculators. We should only remember the number of widgets they added and the order they added them.