Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save radiegtya/7899c0ac92cc7e30131b to your computer and use it in GitHub Desktop.
Save radiegtya/7899c0ac92cc7e30131b to your computer and use it in GitHub Desktop.
Meteoris Quickstart
/*
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