How to listen to an object events ?

How to listen to an object events ?

So, if the action was triggered is dbClick or hover or keypress etc, I can run a function with switch(event){}
case hover : alert(event);
case keyup : do nothing
like this .
is this possible ?