Skip to content

Instantly share code, notes, and snippets.

@erichocean
Created November 7, 2008 17:23
Show Gist options
  • Save erichocean/22910 to your computer and use it in GitHub Desktop.
Save erichocean/22910 to your computer and use it in GitHub Desktop.
/** @namespace */
Cp2 = SC.Object.create( SC.Statechart,
/** @scope Cp2 */ {
// This will create the server for your application. Add any namespaces
// your model objects are defined in to the prefix array.
//server: SC.Server.create({ prefix: ['Cp2'] }),
server: SC.RestServer.create({ prefix: ['Cp2'], postFormat: SC.JSON_FORMAT, escapeJSON: false}),
// This is the Current User of the System. This is where we get all the authentication tokens that get passed
currentUser: null,
// When you are in development mode, this array will be populated with
// any fixtures you create for testing and loaded automatically in your
// main method. When in production, this will be an empty array.
FIXTURES: [],
//core actions
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));
},
failedLoad:function(){
console.log("Core#failedLoad called...");
var handled = NO;
switch(this.state.a){
case 2:
this.goState('a',3);
break;
}
if(!handled) console.log('Cp2#failedLoad 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