Update events.js

fixed trigger return undefined bug