Inter-widget communication


#1

I am pondering how a dojo 2/3 widget can look for another widget.

In this case, I have two dojo 3 widgets - one is a wrapper for SVG that responds to such methods as ‘blink intersection’ or ‘highlight road’. That widget does not care what UI generated that method call (could be a button, or text link…)

A second widget, call it ‘controls’, wraps buttons and text fields that the user uses to identify what, within the SVG, s/he wants highlighted.

In dojo/dijit 1 — I could use registry.byId, or more often, I would use publish and subscribe with the SVG subscribing to the events published by the ‘control’ object.

It isn’t clear how the control widget can find the ‘W’ widget which was created during its (the control’s) render method (I’m using the tutorial documents as a ‘how to’ guide.) Is there anything akin to publish/subscribe using dojo 3 widgets? If not, do I create the receiving widget outside the controlling widget’s render method…

Any guidance is welcome.