API for setting options and events

* improved onEventChange callback to accept type