https://github.com/dev360/backbone.amplify
Amplify storage adapter for Backbone.js
https://github.com/dev360/backbone.amplify
Last synced: about 1 year ago
JSON representation
Amplify storage adapter for Backbone.js
- Host: GitHub
- URL: https://github.com/dev360/backbone.amplify
- Owner: dev360
- Created: 2011-09-01T17:54:14.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-09-03T16:13:44.000Z (almost 15 years ago)
- Last Synced: 2025-04-06T22:42:57.653Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 191 KB
- Stars: 39
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Backbone Amplify Storage
Full cross browser fall back (IE5 - w00t!) for backbone.js, courtesy of amplify.store.js.
## Usage
Include Backbone.amplify after having included Backbone.js:
``
``
``
``
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.
## Browser support
I tested this in IE7, IE9, Firefox 6, Safari 5, and in Chrome 13. The only snag you need to be
aware of is to remember to include the json2 dependency, which is required for IE<8. If you
can verify that it works for more browsers, shoot me a mail and let me know so I can update.
## Credits
This code was largely based on https://github.com/jeromegn/Backbone.localStorage, but I needed
it to work for IE6/7.
Anyhow, its refactored to use amplify.store to accomplish the fallback. Naturally, I copied
the tests as well, thank you [Mark Woodall](https://github.com/llad) for the unit tests, and
big thanks to [Jerome Gravel-Niquet](https://github.com/jeromegn).