Guest User

Untitled

a guest
Jan 22nd, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. A view Class to mediator Class mapping means that there may be multiple mediator instances for a given view type. How would RL know which instance to inject?
  2.  
  3. mediatorMap.mapView(SomeView, SomeMediator);
  4. ..
  5. addChild(new SomeView());
  6. addChild(new SomeView());
  7. addChild(new SomeView());
  8. ..
  9. [Inject]
  10. public var view:SomeMediator; // which one of the 3 mediator instances should we inject? it makes no sense.
  11.  
  12. If you want to inject a mediator, and you know there will only be one instance, you need to map it yourself. You can do that in the mediator's onRegister hook:
  13.  
  14. function onRegister():void {
  15. injector.mapValue(SomeMediator, this);
  16. }
Add Comment
Please, Sign In to add comment