Created
December 27, 2014 13:25
-
-
Save sas1ni69/58cb1b5b312adb2522f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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