simple-todos-react.js 478 B

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