JSFiddle - React, Tailwind, and code Playground

HTML

<pre id="log"></pre>

JavaScript

var cb = $.Callbacks();

cb.add( function() {
    $("#log").append( "cb called\n" );
});

// when invoked once, will leave Callbacks() in an inconsistent state
// (firing=1)
cb.add( function() {
    throw 0;
});
    
// only this one will cause the first callback to be invoked
cb.fire();

// nothing here
cb.fire();
cb.fire();