Skip to content

Instantly share code, notes, and snippets.

@timanglade
Created November 6, 2013 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save timanglade/7341925 to your computer and use it in GitHub Desktop.
Save timanglade/7341925 to your computer and use it in GitHub Desktop.
Saving/restoring Usergrid objects from localStorage
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