Callbacks vs. custom events in vanilla JS

gomakethings.com

In your websites and web apps, you may occasionally want to run some code in response to something that happens. These are often things above-and-beyond the core functionality of your plugin or script. You might have a generic modal plugin, accordion script, or toggle menu feature that you use, and you need to adjust it’s behavior a little in certain situations. For example… After a modal button is clicked, fetch some Ajax content and load it into the modal.

Read more...
Linkedin

Want to receive more content like this in your inbox?