Today I learned that you can very easily trigger custom events in JavaScript. This only works in the DOM, but it is very practical, for example to exchange data between scripts that are unrelated to each other.
In the event.detail object you can send any data.
A simple demo (with a more or less practical example):
Leave a comment
Replied on your own website? Send a Webmention!