123456789101112131415161718192021222324
  1. import { Template } from 'meteor/templating';
  2. import { ReactiveVar } from 'meteor/reactive-var';
  3. import '../imports/startup/accounts-config.js';
  4. import '../imports/ui/body.js';
  5. import './main.html';
  6. Template.hello.onCreated(function helloOnCreated() {
  7. // counter starts at 0
  8. this.counter = new ReactiveVar(0);
  9. });
  10. Template.hello.helpers({
  11. counter() {
  12. return Template.instance().counter.get();
  13. },
  14. });
  15. Template.hello.events({
  16. 'click button'(event, instance) {
  17. // increment the counter when button is clicked
  18. instance.counter.set(instance.counter.get() + 1);
  19. },
  20. });