Saturday, August 24, 2024
HomeProgrammingCallbacks On Internet Elements? | CSS-Tips

Callbacks On Internet Elements? | CSS-Tips


A gem from Chris Ferdinandi that particulars methods to use customized occasions to hook into Internet Elements. Extra importantly, Chris dutifully explains why customized occasions are a greater match than, say, callback capabilities.

With a typical JavaScript library, you go callbacks in as a part of the instantiate course of. […] As a result of Internet Elements self-instantiate, although, there’s no simple method to try this.

There’s a method to make use of callback capabilities, simply not an “simple” method to go about it.

JavaScript gives builders with a method to emit customized occasions that builders can hear for with the Ingredient.addEventListener() technique.

We are able to use customized occasions to let builders hook into the code that we write and run extra code in response to when issues occur. They supply a extremely versatile method to prolong the performance of a library or code base.

Don’t miss the nugget about canceling customized occasions!


Direct Hyperlink →

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments