Yeah that looks like a good way to do it using the module pattern.
That way as you pull in the module you can provide it a mock event
dispatcher in a text context. It needn't be global - the point is the
module you pass it to doesn't need to know where it came from or what
it does, only that it has publish and subscribe methods. You need some
agreement on what your events look like too obviously.

> Say you have 2 modules on a page.  Would you recommend setting each
> module up using the module pattern, returning a method to initialize
> the module, and passing each module a global PubSub object which can
> be used to publish and listen for events?

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to