adding $emit and $on event handlers and listeners