A part from using runEvent()
to execute events, you can also abstract it by using the runRoute()
method. This method is fairly similar but with the added benefit of executing a NAMED route instead of the direct event it represents. This gives you the added flexibility of abstracting the direct event and leveraging the named route.
All the same feature of runEvent()
apply to runRoute()
Just like you can create links based on named routes and params, you can execute named routes and params as well internally via runRoute()
The params argument you pass to the runRoute() method will be translated into event arguments. Therefore they will be passed as arguments to the event the route represents:
In the example above, the userData
named route points to the user.data
event.
If you want to execute module routes, no problem! Just use our @ or :
notation to tell the controller from which module's router we should pick the route from.