API: Added support for user-defined event listeners.