Thomas Cannon

css-tricks.com/callbacks…

JavaScript provides developers with a way to emit custom events that developers can listen for with the Element.addEventListener() method.

We can use custom events to let developers hook into the code that we write and run more code in response to when things happen. They provide a really flexible way to extend the functionality of a library or code base.

Another example of why UJS is so powerful: you start thinking in events.