events: Added support for custom context

The custom context argument allows you to specify with what context
your supplied event handler is executed. It defaults to the
EventEmitter class.

Fixes #8210