Created
November 7, 2008 17:42
-
-
Save erichocean/22917 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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