Created
November 15, 2016 12:33
-
-
Save harmenjanssen/4cd9edcf4eab6765c673c27a419094b9 to your computer and use it in GitHub Desktop.
Small utility if you like to use jQuery but not so much its this-scoped callbacks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Usage: | |
* $('.my-nodes').each(parameterizeJqCallback(myFunction)); | |
* | |
*/ | |
const parameterizeJqCallback = (fn) => function(...args) { | |
return fn($(this), ...args); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment