Skip to content

Instantly share code, notes, and snippets.

@MSch
Created March 1, 2011 01:09
Show Gist options
  • Save MSch/848405 to your computer and use it in GitHub Desktop.
Save MSch/848405 to your computer and use it in GitHub Desktop.
addButtonPressed: function(element, productName) {
var product = DC.store.createRecord(DC.Product, { name: productName });
this._observer = this.addStatechartObserver(product, 'status', 'statusChanged');
product.commitRecord();
},
statusChanged: function(target, key, revision) {
if (SC.kindOf(target, DC.Product) && key === 'status') {
if (target.get(key) === SC.Record.READY_CLEAN) this.gotoState('messages');
// else ignore any other status changes
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment