Question

The Event object is Backbone is clearly an implementation of pubSub ( http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern ) but is the events Hash also? The events will be published regardless of who is receiving the msg, but since it is all pertaining to the same object (in most cases? or all?) maybe that doesn't count. What do you think?

The more I dive into all these modern JavaScript frameworks and libraries, the more I want to have objective means to compare them and I appreciate any opinions, especially those grounded in software engineering theory.

Alternatively, maybe the Events Hash is part of this:

http://en.wikipedia.org/wiki/Message-oriented_middleware

but maybe not pub-sub. Please weigh in.

Was it helpful?

Solution

The events hash is basically a declarative version of $(...).on(...). I wouldn't really describe it as pub/sub. It is a messaging mechanism, but it has much more complexity around DOM event propagation. It allows event cancelling, propagation stopping, and default-behavior blocking, which are beyond the scope of of pub/sub. It is also explicitly tied to the DOM structure of the page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top