Skip to content

Instantly share code, notes, and snippets.

@bryanchow
Created July 5, 2011 19:18
Show Gist options
  • Save bryanchow/1065628 to your computer and use it in GitHub Desktop.
Save bryanchow/1065628 to your computer and use it in GitHub Desktop.
store.js module for Spine.js
// store.js module for Spine.js
// https://github.com/marcuswestin/store.js
// http://maccman.github.com/spine/
(function(Spine, $){
Spine.Model.StoreJS = {
extended: function() {
this.sync(this.proxy(this.saveStore));
this.fetch(this.proxy(this.loadStore));
},
saveStore: function() {
try {
store.set(this.name, this);
}
catch(err) {
}
},
loadStore: function() {
try {
var result = store.get(this.name);
if (result) {
this.refresh(result);
}
}
catch(err) {
}
}
};
})(Spine, Spine.$);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment