TOP - Foundation: 86% - DOM Manipulation and Events
Today I learned about Custom Event.
Learned that new CustomEvent is just like new Event but CustomEvent can add detail for the event which is why CustomEvent is used more.
Understand more clearly about addEventListener, addEventListener is just assigning an event handler ( a fancy way to call a function that execute when the event is fired ) to an event type on an element.
dispatchEvent is literally what its name mean, use to dispatch an event on an element, all the event handlers get assigned on this element with the same event type as the dispatchEvent will be executed.
Still the same knowledge but it feel clearer
Top comments (0)