Quantcast
Channel: politics – Page 8 – Alterform
Viewing all articles
Browse latest Browse all 16

Don’t forget addEvent!

$
0
0

After reading Dustin’s post about forgetting addEvent, I have to disagree.
Not with the part about using Yahoo’s new Event Utility (that part I DO agree with), the part I disagree with is dropping of the addEvent function.

You see, most folks already have some form of addEvent, with all of the standard params, so why force them to go through their code, and replace addEvent with "YAHOO.util.Event.addListener"?

The easier solution is to take your current addEvent function, and make it a wrapper for the new Yahoo event utility, like so:


function addEvent(el, sType, fn, oScope, bOverride){
YAHOO.util.Event.addListener
(el, sType, fn, oScope, bOverride);
}

Now you have an easy way of integrating it into your current scripts without having to rewrite all of your code.

Perhaps a bit obvious to some, but perhaps helpful to others 🙂


Viewing all articles
Browse latest Browse all 16

Latest Images

Trending Articles





Latest Images