javascript - what is one example of the usage of the jquery noop function -


extending link what use of jquery.noop() function?

you can use empty function when wish pass  around function nothing.  useful plugin authors offer optional callbacks;  in case no callback given, jquery.noop execute. 

what mean plugin authors offer optional callbacks, example do.

for example, plugin optional done fail , callbacks:

options: {     done: $.noop,     fail: $.noop,     always: $.noop } 

now plugin author can assume there callback defined each if developer using plugin doesn't pass one.

https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#l577


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -