JSFiddle - React, Tailwind, and code Playground
by krisselden
JavaScript
var callbacks = new jQuery.Callbacks('unique');
var handler = function(m) {
console.log(m + '!');
};
handler.boom = function(target) {
if (typeof target != "function") {
throw new TypeError();
}
};
// first add does not recurse jQuery.each
callbacks.add(handler);
callbacks.fire('fire');
// try to add handler again, should just not add it,
// instead recursively calls jQuery.each on args
callbacks.add(handler);
// this will error now
callbacks.fire('fire');