Signal is never being injected
In app config file I have a Signal/Command mapping
signalCommandMap.map(DisconnectUserSignal).toCommand(DisconnectUserCommand);
Then,
I have two connection classes:
public class BaseConnection implements IBaseConnection
{ when I am trying to inject the signal here: [Inject] public var
disconnectUserSignal:DisconnectUserSignal; // it is always null
_netConnection = new NetConnection();
... } and
public class BBConnection extends DefaultConnectionCallback
implements IBBConnection
{ when I am trying to inject the signal here:
[Inject] public var disconnectUserSignal:DisconnectUserSignal; //
it works perfectly fine
_baseConnection = new BaseConnection(this);
}
Is there any suggestion of what might be the reason?
Thank you
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Stan on 16 May, 2014 04:31 PM
After going through the robotlegs framework documentation - I found the answer:
I changed the _baseConnection to be an interface, and moved everything from BaseConnection's constructor into init method and now I am injecting it inside my BBConnection.
Here how BBConnection looks now:
[Inject] public var baseConnection:IBaseConnection;
public function BBConnection()
{ }
[PostConstruct] public function init():void
{ baseConnection.init(this); }
Now I can successfully inject Disconnect signal inside base connection.
Source: https://github.com/robotlegs/robotlegs-framework/wiki/common-proble...
2 Posted by greenLED on 17 May, 2014 03:36 AM
Hi Stan. The signals are mapped automatically when you call
SignalCommandMap.map(...) or Injector.map(...). If you don't already have
a command for your signal you can map it as a singleton
Injector.map(DisconnectUserSignal).asSingleton();
That way the signal will be injected into other classes. You can later
change the Injector.map for SignalCommandMap.map and a command.
Ondina D.F. closed this discussion on 02 Jul, 2014 07:17 AM.