On Feb 4, 1:16 pm, Diego Perini <[email protected]> wrote: > > Using a "setTimeout()" for a pubsub implementation will work most of > the time if the requirements are not too complex.
I agree, and because of this, my implementation allows for both styles. Clearly, it could do with better documentation :-) > However using real event dispatching instead is better and will yield > an easier debugging environment for developers. How would you go about using event dispatching without using the DOM? I agree that with async anonymous passing of messages, debugging without modifying any code is damn near impossible. But, anyone able to build loosely coupled systems with pubsub and javascript, should be able to reach into the pubsub module and add debugging code. If that is too difficult, then I would advise against using pubsub messaging at all. Pubsub has always been an unwieldy beast, and should only be applied when it's actually needed, and should NOT be the first tool we reach for. Once we do choose to use it, we should understand the consequences of it. I've tried to highlight some of the issues, one might encounter, and have tried to fix some of them. I also have a blog post on the horizon, that compares different options of notifications, hopefully that can also adress some of the issues mentioned in this thread :) /Morgan -- 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]
