Skip to content

Instantly share code, notes, and snippets.

@ro31337
Created September 20, 2015 05:32
Show Gist options
  • Save ro31337/5863163db64574079345 to your computer and use it in GitHub Desktop.
Save ro31337/5863163db64574079345 to your computer and use it in GitHub Desktop.
if (Meteor.isClient) {
// counter starts at 0
Session.setDefault('counter', 0);
Template.hello.helpers({
counter: function () {
return Session.get('counter');
}
});
Template.hello.events({
'click button': function () {
// increment the counter when button is clicked
Session.set('counter', Session.get('counter') + 1);
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment