If you don't need true event functions (e.g. bubbles, stopPropagation), you can implement your own events. addEventListener is just a DOM API, so you really don't need it for your own objects outside of the DOM. If you want to create a linked template around an object, here is a good way to do it, which does not require any additional browser APIs, and should be very reverse.
Let's say you have an object where you want a bunch of events to be included when the send method starts:
var OurDispatcher, dispatcher; OurDispatcher = (function() { function OurDispatcher() { this.dispatchHandlers = []; } OurDispatcher.prototype.on = function(eventName, handler) { switch (eventName) { case "dispatch": return this.dispatchHandlers.push(handler); case "somethingElse": return alert('write something for this event :)'); } }; OurDispatcher.prototype.dispatch = function() { var handler, i, len, ref; ref = this.dispatchHandlers; for (i = 0, len = ref.length; i < len; i++) { handler = ref[i]; setTimeout(handler, 0); } }; return OurDispatcher; })(); dispatcher = new OurDispatcher(); dispatcher.on("dispatch", function() { return document.body.innerHTML += "DISPATCHED</br>"; }); dispatcher.on("dispatch", function() { return document.body.innerHTML += "DISPATCHED AGAIN</br>"; }); dispatcher.dispatch();
In fact, it should not be more complicated than that, for the most part. Thus, you have decent control over your events, and you do not need to worry about backward compatibility or external libraries, because everything there is widely supported. Technically, you could do without setTimeout and handle your callbacks without any APIs. Anything, such as stopPropagation (), will need to be processed independently.
https://jsfiddle.net/ozsywxer/
Of course, there are policies for CustomEvent, but if I do not need advanced event functions, I prefer to transfer my own event system to a class and extend other classes / functions with it.
Here's the CoffeeScript version that JavaScript comes from: https://jsfiddle.net/vmkkbbxq/1/
^^ A bit easier to understand.