registerListeners method
Registers all ApplicationEventListener pods in the ConfigurableListablePodFactory.
This enables Jetleaf components annotated as listeners to receive published application events automatically.
This is part of Jetleaf – a framework which developers can use to build web applications.
Implementation
@protected
@mustCallSuper
Future<void> registerListeners() async {
final eventBus = getApplicationEventBus();
for (final listener in getApplicationEventListeners()) {
eventBus.addApplicationListener(listener: listener);
}
// Register ApplicationListener pods
final al = Class<ApplicationEventListener>(null, PackageNames.CORE);
final names = await getPodNames(al, includeNonSingletons: true);
for (final name in names) {
final listener = await getPod(name, null, al);
eventBus.addApplicationListener(listener: listener, podName: name);
}
return Future.value();
}