Skip to content

Instantly share code, notes, and snippets.

@sas1ni69
Created December 27, 2014 13:21
Show Gist options
  • Save sas1ni69/df1a1adc8d1fa5399fbc to your computer and use it in GitHub Desktop.
Save sas1ni69/df1a1adc8d1fa5399fbc 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");
},
users: [
{name: 'Jack', age: 25}, {name: 'James', age: 23}, {name: 'Matt', age: 21}
]
});
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