Skip to content

Instantly share code, notes, and snippets.

@ColinCampbell
Created August 12, 2010 23:11
Show Gist options
  • Save ColinCampbell/521946 to your computer and use it in GitHub Desktop.
Save ColinCampbell/521946 to your computer and use it in GitHub Desktop.
var query = SC.Query.local(MyApp.Record);
var data = MyApp.store.find(query);
// old way
var f = function() {
if (data.get('status') & SC.Record.READY) {
data.removeObserver('status', this, f);
// ...
}
};
data.addObserver('status', this, f);
// proposed way
data.addFiniteObserver('status', this, function() {
if (data.get('status') & SC.Record.Ready) {
// ...
return YES;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment