Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 26, 2019 01:07 am GMT

Understanding Event Emitters

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. Weve 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.

There may be times you want to fire a custom event when youre working in an existing codebase. Not specifically a DOM … Read article

The post Understanding Event Emitters appeared first on CSS-Tricks.


Original Link: https://css-tricks.com/understanding-event-emitters/

Share this article:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks