Events: Remove common function triggerCustomEvent()

Fixes gh-7805