Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. using riot.RiotTools;
  2.  
  3. @:tagName('counter')
  4. @:templateFile('templates/counter/counter.html')
  5. @:cssFile('templates/counter/counter.css')
  6. @:autoMount
  7. @:keep
  8. class Component implements riot.IRiotComponent {
  9. public var view:Dynamic;
  10.  
  11.  
  12. @:bind function incr() {
  13. view.counter++;
  14. }
  15.  
  16. @:bind function async_incr() {
  17. haxe.Timer.delay(function() {
  18. view.counter++;
  19. update();
  20. },2000);
  21. }
  22.  
  23. function mount() {
  24. trace('component mounted on $root()');
  25. untyped console.log(root());
  26. }
  27.  
  28. public function new(v,opts) {
  29. bind_view(v);
  30. view.counter = 0;
  31. view.on('mount',mount);
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement