Understanding Event Emitters

added by JavaScript Kicks
3/26/2019 2:00:24 AM

751 Views

Consider, a DOM Event: const button = document.querySelector("button"); button.addEventListener("click", (event) => /* do something with the event */) We added a listener to a button click. We've subscribed to an event being emitted and we fire a callback when it does. Every time we click that button, that event is emitted and our callback fires with the event.


0 comments