This repository has been archived by the owner on Feb 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
FAQ
sammyt edited this page Sep 13, 2010
·
4 revisions
If you’ve got a question about Dawn, feel free to add a Q: and we’ll do our best to provide an A: as soon as we can.
Q: How do I create non application wide event bus?
A: The easiest way would be to use named injections. Imagine you have a requirement for two instances of INotificationBus
, one for notifications relating to one part of the application and another bus for the second part of the application. Choose which classes get which type of INotificationBus
(or both) by naming the Inject
metadatas e.g.
class ClassInPartOneOfApplication{ [Inject(name="part one")] public var bus:INotificationBus } class ClassInPartTwoOfApplication{ [Inject(name="part two")] public var bus:INotificationBus } class ClassThatWantsBothBuses{ [Inject(name="part one")] public var busPartOne:INotificationBus [Inject(name="part two")] public var busPartTwo:INotificationBus }
the configuration for that scenario would look something like the below
public function create( mapper:IMapper ):void{ mapper.map(INotificationBus).toSelf().asSingleton().withName("part one"); mapper.map(INotificationBus).toSelf().asSingleton().withName("part two"); }