tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/179-passing-events-between-contextsRobotlegs: Discussion 2018-10-18T16:35:18Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/31834202010-10-01T19:12:20Z2010-10-01T19:12:20Zpassing events between contexts?<div><p>Hi Gerry,</p>
<p>One way is to leave the contexts as they are (with separate event buses), and pass in a third Event Dispatcher that they can talk through.</p>
<pre>
var sharedDispatcher:IEventDispatcher = new EventDispatcher();
player = new Player(sharedDispatcher);
playlist = new Playlist(sharedDispatcher);
</pre>
<p>You'd need to pass the shared event dispatcher through to each context and map it into each injector.</p>
<p>There are plenty other ways to do it - using a modular utility for example - but the approach above is probably the simplest for the job at hand.</p>
<p>Hope that helps!</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/31834202010-10-01T21:45:18Z2010-10-01T21:45:18Zpassing events between contexts?<div><p>Thanks Shaun! I will also have the opportunity to spend more time on this part soon, I would love any other suggestions that you might personally prefer.</p></div>Gerry Kohtag:robotlegs.tenderapp.com,2009-10-18:Comment/31834202010-10-03T10:58:29Z2010-10-03T10:58:29Zpassing events between contexts?<div><p>Check out the old version of robotlegs modular (on my fork at github.com/stray ) for the old-skool way of wiring contexts together - it will make obvious most of the 'gotcha' stuff.</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/31834202010-10-06T16:50:44Z2010-10-06T16:50:44Zpassing events between contexts?<div><p>thanks stray, i'll check it out now.</p></div>Gerry Kohtag:robotlegs.tenderapp.com,2009-10-18:Comment/31834202010-10-14T23:16:24Z2010-10-14T23:16:24Zpassing events between contexts?<div><p>shaun,</p>
<p>do you have any examples of mapping an additional context into an injector? i'm not sure of the syntax to do this.</p></div>Gerry Koh