Created
November 6, 2013 18:51
-
-
Save timanglade/7341925 to your computer and use it in GitHub Desktop.
Saving/restoring Usergrid objects from localStorage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
projects = new Usergrid.Collection({ | |
"client": client, | |
"type": "books", | |
"qs": { ql:'order by title asc', limit: 999} | |
}); | |
projects.fetch(function() { | |
// Save to local storage | |
localStorage.setItem('books', projects.serialize()); | |
}) | |
// Restore from local storage | |
projects = client.restoreCollection(localStorage.getItem('projects')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment