Skip to content

Instantly share code, notes, and snippets.

@ColinCampbell
Created March 5, 2011 21:37
Show Gist options
  • Select an option

  • Save ColinCampbell/856743 to your computer and use it in GitHub Desktop.

Select an option

Save ColinCampbell/856743 to your computer and use it in GitHub Desktop.
var record = MyApp.store.find(MyApp.Record, 1);
record.addObserver('status', this, function() {
if (record.get('status') === SC.Record.READY_CLEAN) {
record.removeObserver('status', this, arguments.callee);
// code here
}
});
// if we want the observer called even if the record is already loaded
if (record.get('status') === SC.Record.READY_CLEAN) record.notifyPropertyChange('status');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment