I found in an article on function .noop()
, which in this library should be included. What is doing? Just call fallbacks? How to use this function?
This method does not accept any arguments.
http://api.jquery.com/jQuery.noop/
Well, it does state in the docs:
This is useful for plugin authors who offer optional callbacks; in the case that no callback is given, something like jQuery.noop could execute.
Probably a fast way to create a default function. And as an added bonus, without creating an anonymous function every time that function is called.
function aFunctionThatAcceptsACallback(callback){
callback = callback || jQuery.noop;
// do something
// safely call callback, regardless if the function received any
callback();
}
$.noop() is an empty function which returns nothing.
In another word, it's just equivalent to this:
$.noop => function () {}//returns nothing
It has nothing to do with the function so it no longer requires to accept arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With