I am having trouble understanding in what situations you would use custom events.
I mean the ones created by the CustomEvent
constructor.
I understand the syntax itself, just not why it is useful. It would be nice if somebody could provide an example of real world application of custom events.
I use it (shameless plug) to raise "resize" events on div elements and then use a separate binding framework (aurelia) to listen to those events.
the explicit code example is:
where erd is element-resize-detector that allows you to detect when any div changes shape.