I wanted to inject the module context in it upon its creation,
probably a mistake as I never found an example with modularity for
RL2.
1) I wait for the container's ElementExistenceEvent.ELEMENT_ADD
2) then I inject into it using the good old: injector.injectInto(event.element)
3) knowing that the module has a setter parentInjector(value:Injector)
annotated with [Inject] I use it to instantiate a new ModuleContext(this).
I'm not using the value (Injector) at all, it just does the
job creating the new context as you can see. The ModuleContext class
contains the custom config class (ModuleConfig) so I can
configure the context the way I want:
4) ModuleConfig.configure():
mediatorMap.mapView(ICustomModule).toMediator(ModuleMediator);
mediatorMap.handleView(contextView, ICustomModule);
I map the interface to mediator and than manually trigger the
mediator creation.
I'm still trying to figure out how to use it properly, but at least
the ScopedEventDispatcherExtension is working between
shell/modules and for the rest, maybe you can help me find THE
Way :)
What I need is pretty simple:
- be able to create multiple module instances (same or different
classes)
- each one having its own custom context config
- having a mediator for the whole module (main module class)
- be able to mediate separately some views in it
So maybe you are right and there is no need for the ViewMap at all,
I just need to figure out how to assemble the puzzle.
Cheers,
Adnan