Quantcast
Channel: digitaldogbyte.com
Viewing all articles
Browse latest Browse all 10

Robotlegs using a shared eventdispatcher between multiple contexts

$
0
0

My last couple posts discussed two different methods of writing modular applications using the Robotlegs framework. This post will demonstrate yet another method of writing modular applications in Robotlegs using a shared eventDispatcher between the modules.

This approach requires the creation of a getter method for the eventDispatcher from the Application Shell’s context. The eventDispatcher is then injected into the contexts of each module using:

1
2
// injects the application shell's eventDispatcher into the module's context
injector.mapValue(EventDispatcher, Application.application.applicationEventDispatcher, "ApplicationEventDispatcher");

The “ApplicationEventDispatcher” is then used to listen to events and to dispatch events throughout the entire application.

Here is the demo and the source code.


Viewing all articles
Browse latest Browse all 10

Trending Articles