Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to pass data through to a $.delegate() callback #187

Closed
pryley opened this issue May 11, 2016 · 1 comment
Closed

allow to pass data through to a $.delegate() callback #187

pryley opened this issue May 11, 2016 · 1 comment

Comments

@pryley
Copy link

pryley commented May 11, 2016

Maybe it's not necessary, but it would allow something like this (which is somewhat similar to jQuery's delegate/on):

$.delegate( subject, type, selector, callback, pass_this_data_to_the_callback );

instead of this:

$.delegate( subject, type, selector, function( e )
{
    e.preventDefault();
    callback( pass_this_data_to_the_callback );
});
@LeaVerou
Copy link
Owner

You can already do that via:

$.delegate( subject, type, selector, callback.bind(null, pass_this_data_to_the_callback));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants