On May 4, 5:04 pm, tarini <[email protected]> wrote: > hi to all, > i've wrote a little jquery plugin and i think it will be very useful > and it will be a good idea integrate this in jquery core. > it's a very short piece of code and it's about control callback > function setting scope and custom parameters. > > if you're interested i've published it on google code (http:// > code.google.com/p/jquerycallback/). > > it's very simple and not-invasive: its api contains just two methods: > $.callback and $.delegate > > in common pattern developers use to create anonymous function to > control parameters ( $("div).click(function(event) { alert > (custom_parameter) }) ) but I think it's not a good idea especially > about code-reusability. > > any feedback, critics or ideas for improvement will be very > appreciated :)
I suppose you haven't seen the ongoing discussion here about event handler "scoping": http://groups.google.com/group/jquery-dev/browse_thread/thread/ebff360ba08b60eb?hl=en As for $.callback, I think it's redundant as you can already pass data to the handler like this: function getDrink(e){ if (e.data.need == 'coffee') //... } $('#myel').bind('click', {need: 'coffee'}, getDrink); http://docs.jquery.com/Events/bind#typedatafn unless I'm missing a special case. cheers -- ricardo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
