how to check which event is fired in javascript