Injector and parenting

matej's Avatar

matej

23 Apr, 2013 12:44 PM

Hello,

I was wondering if it is possible to get instance of the parent injector mapping not by Class object, but just with string.

@@@@@ commandMap = injector.parentInjector.getInstance(ISignalCommandMap); commandMap.map(soundToRegister.signal).toCommand(PlaySoundCommand); @@@@@

because I use signalCommandMap from parent, the only way to do this now if soundToRegister.signal is Class type, and that is acquired from parent by getClassDefinitionByName.
Is there a way to do that from inside the module, because I have the parent injector available?

That way I can just pass the string and the module itself is more independent?

  1. Support Staff 1 Posted by creynders on 24 Apr, 2013 01:46 PM

    creynders's Avatar

    Hi there,

    I haven't had time yet to delve into modules in RL v2 and my co-moderators are abroad.
    There's an example made by @dotdotcommadot which uses modules and signals:
    https://github.com/dotdotcommadot/ModularRL

    It should be up-to-date too!

    Hope this helps!

  2. Support Staff 2 Posted by creynders on 16 May, 2013 09:35 AM

    creynders's Avatar

    I'm closing this for now, if you have any more questions let us know!

  3. creynders closed this discussion on 16 May, 2013 09:35 AM.

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