Assert that event listeners are real functions

Fixes #1028.
Merge pull request #1069 from spicyj/gh-1028

Assert that event listeners are real functions