Well, there are several approaches to custom events. I was watching Nicholas's presentation long time ago, but if I recall correctly, his idea was to have single messaging bus (represented by sandbox object) that could be used for exchanging data between modules. In this pattern modules do not know about each other, so you can't "subscribe" to events fired by another module, you can only listen to the what is coming from sandbox object.
Here is a link to the whole presentation: http://yuilibrary.com/theater/nicholas-zakas/zakas-architecture/ On Mon, Aug 22, 2011 at 2:49 PM, Dmitry Pashkevich <[email protected]> wrote: > I may have missed the point but I don't think that event name should contain > the name of the module or class that fires them. Because when you listen to > the event you access the object that fires it anyway: > myButton.listenEvent('toggle', function() {...}); > myDndManager.listenEvent('drop', function() {...}); > > So why should I name events like 'DndManager->drop'? Even if you need to > dynamically determine the object that fired the event you can always include > the object itself in event parameters: > this.fireEvent('drop', this, data) > > Also, are you trying to implement the pubsub model or the 'regular' event > model where one object directly subscribes to events of another object? > > -- > 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] > -- 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]
