one makes use of an event library - here is an example, but it is one I have not used:
https://github.com/igorw/evenement - but is the same as React/Vue emit idea
So, the action can be defined elsewhere, the emit call is only for put in the correct place when some thing happens, therefore is only one line of code.