Last active
October 27, 2015 15:57
-
-
Save radiegtya/7899c0ac92cc7e30131b to your computer and use it in GitHub Desktop.
Meteoris Quickstart
This file contains 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
/* | |
create a namespace called Radiegtya.SiteController | |
*/ | |
Namespace('Radiegtya.SiteController'); | |
/** | |
Create controller which extends Meteoris Controller | |
*/ | |
Radiegtya.SiteController = Meteoris.Controller.extend({ | |
/* set default counter at constructor */ | |
constructor : function() { | |
Session.setDefault('counter', 0); | |
}, | |
/* passing data to index helpers template */ | |
index: function() { | |
//return some value, to be passed on index.js | |
return { | |
counter: this.getCounter(), | |
myName: "Ega Radiegtya", | |
myHobby: "Drinking Coffee" | |
}; | |
}, | |
/* get counter from session */ | |
getCounter: function(){ | |
return Session.get("counter"); | |
}, | |
/* set counter to session, by current counter session + 1 */ | |
setCounter: function(counter){ | |
Session.set('counter', this.getCounter() + 1); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment