1 if (Meteor.isClient) { 2 // counter starts at 0 3 Session.setDefault('counter', 0); 4 5 Template.hello.helpers({ 6 counter: function () { 7 return Session.get('counter'); 8 } 9 }); 10 11 Template.hello.events({ 12 'click button': function () { 13 // increment the counter when button is clicked 14 Session.set('counter', Session.get('counter') + 1); 15 } 16 }); 17 } 18 19 if (Meteor.isServer) { 20 Meteor.startup(function () { 21 // code to run on server at startup 22 }); 23 }