Backbone localStorage Backend
An adapter that replaces Backbone.sync
to save to window.localStorage
instead of to the server.
Usage
Import backbone.local
and attach it to your models and collections:
;; const SomeCollection = Collection; const SomeModel = Model;
To synchronise with the server, you can pass the ajaxSync
flag to any options:
const myModel = ;myModel; myModel;
Contributing
Install NodeJS and run yarn
or npm i
to get your dependencies, then:
- Open an issue identifying the fault
- Provide a fix, with tests demonstrating the issue
- Run
npm test
- Create a pull request
Acknowledgments
- Jerome Gravel-Niquet: Wrote the initial
backbone.localstorage
- Mark Woodall: Initial tests (now refactored);
- Martin Häcker: Many fixes and the test isolation.