[ 2 posts ]

hame25

  • Joined: Thu Apr 26, 2012 5:34 am
  • Posts: 35
  • Offline
  • Profile
Tags:

Listening to custom events generated by another library

Post Posted: Tue Jun 12, 2012 11:52 am
+0-
Hi,

I've inherited some legacy code written in jquery that is creating some custom events.

The new code is written in yui3 and I now need to listen for these legacy custom events.

Is this possible using the yui custom event system?

Thanks in advance

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 619
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: Listening to custom events generated by another library

Post Posted: Wed Jun 13, 2012 7:34 am
+0-
No, jQuery isn't compatible with YUI that way. You can, while you migrate your code, listen to jQuery events with jQuery and do actions in YUI from those event listeners:
Code:
jQuery('#foo').on('custom', function () {
  Y.one('#bar').addClass('baz');
});

In YUI you rarely fire custom events from a Node. Most of the time you use plugins or widgets for this. Sometimes you might want to fire a "global" event by doing Y.fire('custom'), but that is usually used for events relevant to the whole document.
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum