incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Mueller <pmue...@gmail.com>
Subject Re: [DISCUSS] Switching out Channel's in callback-js for an event module
Date Thu, 01 Dec 2011 22:12:35 GMT
On Thu, Dec 1, 2011 at 16:48, Gord Tanner <gtanner@gmail.com> wrote:
> Please see reference branch here:
> https://github.com/gtanner/callback-js/tree/event
>
> One of the issues with Channel's in a module based system is that it is
> awkward to keep track to a central repository of channel objects.

I guess I'm a n00b.  I don't know what a Channel is.

> I coded up a quick prototype using an event module.  This gives us the
> ability to trigger and sync on events by just using a string (rather than
> an instance created before hand). It cleans up some of the code and doesn't
> require the pre-construction of all the channels before hand.

Your API is actually fairly close the nodejs's "events" module:

    http://nodejs.org/docs/v0.6.3/api/events.html

Close, but different.  In addition to the shape being different, the
receiver/subject of the functions/methods is different - in your case,
the subject is a global string identifying the event itself; in node's
case, events are objects which are instances of EventEmitter, with
method names closely corresponding to some of your function names.

So, here's an alternative strategy:

- implement a compatible nodejs "events" module

- implement a separate module which has a list of the global events we
think we'll need, with the ability to add more, somehow.  Those global
events would, of course, be instances of our compatible EventEmitter
class.

The only thing I wonder about is "implementing a compatible version of
a nodejs module".  You'd think that would be a kosher thing to do, at
least if you did it in a clean-room fashion.  But, who knows these
days.

-- 
Patrick Mueller
http://muellerware.org

Mime
View raw message