Skip to content

Instantly share code, notes, and snippets.

@sas1ni69
Created December 27, 2014 13:25
Show Gist options
  • Save sas1ni69/58cb1b5b312adb2522f8 to your computer and use it in GitHub Desktop.
Save sas1ni69/58cb1b5b312adb2522f8 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