JavaScript before and after jQuery

There was a time when a simple mouse click can be caught by a simple function, element.onClick = functionName. This was good till the time another function came about that wanted to listen to the same click. This was solved by adding the addListenerEvent function from the DOM function. This had added as many possible listener functions, and we used to adopt this approach.

However, such happenings are meant to reoccur as we are now facing the same problem with AJAX calls. AJAX uses a single callback function and not only the jQuery $ajax(), but also the XMLHttpRequest object which has similar problems.

Get Mastering JavaScript Promises now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.