Guest User

Untitled

a guest
Apr 13th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. client/main.js:
  2.  
  3. import { Template } from 'meteor/templating';                                                                                                                                          
  4. import { ReactiveVar } from 'meteor/reactive-var';                                                                                                                                      
  5. import '../imports/ui/body.js';                                                                                                                                                        
  6. import './main.html';                                                                                                                                                                  
  7.                                                                                                                                                                                        
  8. Template.hello.onCreated(function helloOnCreated() {                                                                                                                                    
  9.   // counter starts at 0                                                                                                                                                                
  10.   this.counter = new ReactiveVar(0);                                                                                                                                                    
  11. });                                                                                                                                                                                    
  12.                                                                                                                                                                                        
  13. Template.hello.helpers({                                                                                                                                                                
  14.   counter() {                                                                                                                                                                          
  15.     return Template.instance().counter.get();                                                                                                                                          
  16.   },                                                                                                                                                                                    
  17. });                                                                                                                                                                                    
  18.                                                                                                                                                                                        
  19. Template.hello.events({                                                                                                                                                                
  20.   'click button'(event, instance) {                                                                                                                                                    
  21.     // increment the counter when button is clicked                                                                                                                                    
  22.     instance.counter.set(instance.counter.get() + 1);                                                                                                                                  
  23.   },                                                                                                                                                                                    
  24. });
Add Comment
Please, Sign In to add comment