Skip to content

ajpiano/Backbone.localStorage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

Backbone.localStorage

Quite simply a localStorage adapter for Backbone. It's a drop-in replacement for Backbone.Sync() to handle saving to a localStorage database.

Usage

Include Backbone.localStorage after having included Backbone.js:

<script type="text/javascript" src="backbone.js"></script>
<script type="text/javascript" src="backbone.localStorage.js"></script>

Create your collections like so:

window.SomeCollection = Backbone.Collection.extend({
  
  localStorage: new Store("SomeCollection"), // Unique name within your app.
  
  // ... everything else is normal.
  
});

Feel free to use Backbone as you usually would, this is a drop-in replacement.

Credits

Thanks a lot to Jeremy Ashkenas who refactored pretty much the whole code.

About

A localStorage AND sessionStorage adapter for Backbone.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%