Skip to content

Instantly share code, notes, and snippets.

@erichocean
Created November 7, 2008 17:42
Show Gist options
  • Save erichocean/22917 to your computer and use it in GitHub Desktop.
Save erichocean/22917 to your computer and use it in GitHub Desktop.
// THIS:
successfulLoad:function(){
console.log("Core#successfulLoad called...");
var handled = NO;
switch(this.state.a){
case 2:
if(SC.Store.findRecords({recordType: Cp2.LandingPage}).length > 0){
this.goState('a','5');
}
else if(SC.Store.findRecords({recordType: Cp2.LandingPage}).length){
this.goState('a','4');
}
handled = YES;
break;
}
if(!handled) console.log('Cp2#sucessfulLoad Aaction not handled in state %@[%@]'.fmt('a',this.state.a));
},
// SHOULD BE THIS:
successfulLoad:function(){
console.log("Core#successfulLoad called...");
var handled = NO;
switch(this.state.a){
case 2:
if(SC.Store.findRecords({recordType: Cp2.LandingPage}).length > 0){
this.goState('a','5');
handled = YES;
}
else if(SC.Store.findRecords({recordType: Cp2.LandingPage}).length){
this.goState('a','4');
handled = YES;
}
break;
}
if(!handled) console.log('Cp2#sucessfulLoad Aaction not handled in state %@[%@]'.fmt('a',this.state.a));
},
// EVEN BETTER:
successfulLoad:function(){
console.log("Core#successfulLoad called...");
var handled = NO;
switch(this.state.a){
case 2:
var recs = SC.Store.findRecords({recordType: Cp2.LandingPage});
if (recs && recs.length > 0){
this.goState('a','5');
handled = YES;
}
else {
this.goState('a','4');
handled = YES;
}
break;
}
if(!handled) console.log('Cp2#sucessfulLoad Aaction not handled in state %@[%@]'.fmt('a',this.state.a));
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment