Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 1.12 KB

File metadata and controls

29 lines (17 loc) · 1.12 KB

Backbone Opensocial

AppDataStore

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.

Usage

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.

Running Specs

The test specs are written using Jasmine.js. Open spec/spec.html in your browser to run the suite.

Credits

Thanks to Jerome Gravel-Niquet for the Backbone.localStorage adapter which served as an example for how to build this.