AppDataStore is an OpenSocial adapter for Backbone data persistence. It is a drop in replacement for Backbone.Sync() to handle saving to an OpenSocial container's AppData store.
Include Backbone.OpenSocial.AppData after having included Backbone.js
<script type="text/javascript" src="backbone.js"></script>
<script type="text/javascript" src="backbone.opensocial.appdata.js"></script>
Create your collections like so:
window.SomeCollection = Backbone.Collection.extend({
appDataStorage: new AppDataStore("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.
The test specs are written using Jasmine.js. Open spec/spec.html in your browser to run the suite.
Thanks to Jerome Gravel-Niquet for the Backbone.localStorage adapter which served as an example for how to build this.