▲ | chrismorgan 7 days ago | |||||||
Using the event dispatch mechanism is flat-out bigger, anyway. Here’s the interface of the original script (that is, global pub/sub functions taking a name), except that the receiver site no longer needs to look at the .detail property so it’s better:
The original was 149 bytes; this is 97.(The nullish coalescing assignment operator ??= has been supported across the board for 4½ years. Avoiding it will cost six more bytes.) | ||||||||
▲ | ftigis 7 days ago | parent [-] | |||||||
This isn't the same though. With EventTarget, if one of the callback throws, the later callbacks would still get called. With yours the later callbacks don't get called. | ||||||||
|