Created
October 20, 2019 16:24
-
-
Save oriadam/bad7bc21ccfb57e3eba2d0ddf25c3269 to your computer and use it in GitHub Desktop.
add jQuery functionality `onAndNow` to add event listener and execute it once.
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
// call the handler now and on events | |
jQuery.fn.extend({ | |
onAndNow: function(events, func) { | |
// TODO: Support the data object | |
return this.each(func).on(events, func); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment