In the big scheme of event handling, pubsub achieves the same end result as if we had used custom jQuery event handlers. However, the benefit of using pubsub in this situation is twofold:
$.publish and $.subscribe aren’t bound to any DOM elements, which, as anybody who has ever had a webpage bog down due to too many event handlers can attest, is a positive thing.
Publishers and subscribers are loosely coupled, making it possible to easily define one or more subscribers to listen for a topic without knowing or caring what publishers exist on a page. This provides a measure of freedom in organizing your code based more on subject matter of the action than subject matter of the source page.
For example, we have several areas in the application where we allow users to create an audience group, a process that is the same regardless of triggering event. Instead of having separate event handlers for each page that allows group creation, we could have a global subscriber for the topic “/group/add” stored in a utility file included on all pages, just waiting for that topic to be published, not caring if it’s coming from audience main, create import, or the copy to groups dialog.