Hi,

sub wrote:
> 
> I could use plain on events in qx objects with objects attaching
> listeners.
> I've also looked at the message bus framework - I'm a little confused as
> to
> what more does a message bus provide me.
> 
> Can any one give a run down of how they differ?
> 

the difference between an event and a message is that you dispatch events on
the level of individual object, i.e. you have to know which object fires an
event and attach a listener on this specific object.

Messages, in contrast, are dispatched on one central message bus, i.e. the
messages can be subscribed to at any time and they are available from
everywhere in the code. The second difference is that you can listen for
specific message names (such as "updateModels") or use a filter which
captures all messages matching this filter:

qx.event.message.Bus.getInstance().subscribe("update*",function(e){
  // this will capture "updateModel" and "updateLabel" etc.
  var data = e.getData();
  var name = e.getName(); // the name of the message
  alert([name,data]);
},this);

qx.event.message.Bus.getInstance()​.dispatch("updateModel","Foo!");
qx.event.message.Bus.getInstance().dispatch("updateLabel","Bar!");

HTH,

Christian
​​​​​​​​​​​​
-- 
View this message in context: 
http://n2.nabble.com/Message-Bus-vs-event-system-tp4006265p4008139.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to