Guest User

Untitled

a guest
Jul 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. YUI.add('event-handler', function(Y) {
  2.  
  3. var YArray = Y.Array;
  4.  
  5. function EventHandler() {}
  6.  
  7. //Y.Base.prototype.eventHandler = {
  8. Y.mix(EventHandler.prototype, {
  9.  
  10. add : function(event) {
  11.  
  12. this.events = this.events || [];
  13.  
  14. if (Y.Lang.isArray(event)) {
  15. YArray.each(event, function(ev) {
  16. this.events.push(ev);
  17. }, this);
  18. } else {
  19. this.events.push(event);
  20. }
  21.  
  22. },
  23.  
  24. destroy : function() {
  25.  
  26. YArray.each(this.events, function(eh) {
  27. eh.detach();
  28. });
  29.  
  30. }
  31. });
  32.  
  33. Y.EventHandler = EventHandler();
  34.  
  35. });
Add Comment
Please, Sign In to add comment