Assert that event listeners are real functions

Fixes #1028.