扩展此链接What is the use of jQuery.noop() function?
You can use this empty function when you wish to pass
around a function that will do nothing.
This is useful for plugin authors who offer optional callbacks;
in the case that no callback is given, something like jQuery.noop could execute.
提供可选回调的插件作者意味着什么,例如。
答案 0 :(得分:1)
例如,一个带有可选完成的插件失败并始终回调:
options: {
done: $.noop,
fail: $.noop,
always: $.noop
}
现在插件作者可以假设为每个插件定义了一个回调,即使使用插件的开发人员没有通过一个回调。
https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L577