var MyEvent = function(type="") {
    this.type = type;
    this.listeners = [];
};

MyEvent.prototype.addListener = function(listener) {
    this.listeners.push(listener);
}

MyEvent.prototype.dispatch = function() {
    for (var listener of this.listeners) {
        var ret = listener.apply(null, arguments);
        if (!ret) {
            return;
        }
    }
}