答案 0 :(得分:1)
您可以通过调用has
方法而不传递任何内容来执行此操作:
var callbacks = $.Callbacks();
var empty = !callbacks.has();
这是没有记录的,但我通过examining the source找到了行为:
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function (fn) {
return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length);
},