tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/105-a-quick-one-about-signals-rl-integrationRobotlegs: Discussion 2018-10-18T16:35:13Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T12:17:40Z2010-06-04T12:56:34ZA quick one about Signals / RL integration<div><p>Hi all,</p>
<p>First of all thanks a lot to the people who did all the hard
work, RL is the first framework I use in production (outside of
customized MVC ones) and I have to say the more I use it, the more
I like it.</p>
<p>But there's still something I don't get. I'm trying to map a
Signal to a Command. So in the context (a SignalContext), I've got
:</p>
<p>signalCommandMap.mapSignalClass(FullscreenRequested,
ToggleFullscreen);</p>
<p>Inside a mediator (that mediates a button), I've added a
reference to inject:</p>
<p>[Inject] public var fsEvent:FullscreenRequested;</p>
<p>Then inside a click event:</p>
<p>fsEvent.dispatch();</p>
<p>Pretty easy. I was then thinking that the command should be
triggered, but it's not! I can see a trace in the click event but
the command is neither fired nor even created. Any ideas?<br></p></div>stftag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T12:38:29Z2015-10-19T23:47:51ZA quick one about Signals / RL integration<div><p>Hi Stef,</p>
<p>I assume fsEvent isnt null as that would cause a null reference
when you try to call dispatch. That means that it is getting the
wrong instance from somewhere.</p>
<p>Are you mapping a singleton to FullscreenRequested too?</p>
<p>Mike</p></div>mike.canntag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T12:51:02Z2010-06-04T12:51:04ZA quick one about Signals / RL integration<div><p>Yeah I did actually, inside the context (otherwise I would have
had missing injection error):</p>
<p>injector.mapSingleton(FullscreenRequested);</p>
<p>Sorry forgot to mention it.</p></div>stftag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T13:00:38Z2015-10-19T23:47:51ZA quick one about Signals / RL integration<div><p>Ah, well im not sure what is going on with your missing
injection but if you are mapping a signal to a command you shouldnt
map a singleton too, that will cause a problem.</p>
<p>Mike</p></div>mike.canntag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T13:15:27Z2010-06-04T13:15:29ZA quick one about Signals / RL integration<div><p>Okay I removed the singleton in the context, so the only thing
related to that Signal is the mapping to the Command:</p>
<p>signalCommandMap.mapSignalClass(FullscreenRequested,
ToggleFullscreen);</p>
<p>I tried to create an instance of the Signal in the mediator:</p>
<p>private var fsEvent:FullscreenRequested;</p>
<p>then dispatch it. But once again, the mapping just doesnt work.
Any ideas for a workaround to handle that?<br></p></div>stftag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T13:19:08Z2015-10-19T23:47:51ZA quick one about Signals / RL integration<div><p>Did you mean private:</p>
<p>private var fsEvent:FullscreenRequested;</p>
<p>As this wont be recognised by the injector if you want it to be
injected it must be public and decorated with [Inject] so:</p>
<p>[Inject] public var fsEvent:FullscreenRequested;</p>
<p>Mike</p></div>mike.canntag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T13:20:50Z2010-06-04T13:20:50ZA quick one about Signals / RL integration<div><p>I'm not too familiar with the SignalCommandMap, but I do know
that Joel just released a bugfix (yesterday). Are you running the
latest versions of RL (v1.1.0 beta8) and SignalCommandMap?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-04T15:03:44Z2010-06-04T15:03:44ZA quick one about Signals / RL integration<div><p>This is related to the bugfix from yesterday related to RL1.1
and the SignalCommandMap utility. My apologies for this. The
utility now has a unit test to cover this scenario ;)</p>
<p><a href=
"http://github.com/joelhooks/signals-extensions-CommandSignal/commit/747f973ec70d88db4d054199f6f7e360beeb69d4">
http://github.com/joelhooks/signals-extensions-CommandSignal/commit...</a></p></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-05T22:06:20Z2010-06-05T22:06:20ZA quick one about Signals / RL integration<div><p>Wow that a was a perfect timing^^ I tested it and it works.
Thanks!</p></div>stftag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-10T13:23:40Z2010-06-10T13:23:40ZA quick one about Signals / RL integration<div><p>Got a similar problem now, inside a model proxy:</p>
<p>The context links an Signal class to a Command:<br>
signalCommandMap.mapSignalClass(BufferManagerEvent,
BufferManager);</p>
<p>Then inside the model proxy:</p>
<p>[Inject] public var buffermanagerEvent:BufferManagerEvent;
buffermanagerEvent.dispatch();</p>
<p>I'm using lots of Signals in that class (around 15), and they
are all dispatched and catched by views for example. But this one
is the only one that's related to a Command in the context (others
are mapped as singletons). The Command is never fired, and no
errors are returned.</p></div>stftag:robotlegs.tenderapp.com,2009-10-18:Comment/18508722010-06-14T09:36:36Z2010-06-14T09:36:36ZA quick one about Signals / RL integration<div><p>Just to make the post going up - anyone got any idea on that?
The problem is pretty simple I guess, but I can't make it work!</p></div>stf