I'm trying to emit custom events from my custom object like so:
var CustomObject = function () {
this.customEvent = new Event('afterInit')
/* init code goes here*/
this.dispatchEvent(this.customEvent)
}
But my object cannot dispatch (i.e. dispatchEvent is not a property of my object) and I cannot bind to it. What is the correct syntax for firing custom events from custom objects?