Force function onEvent() parameter type to be Event