/**
 * tiny event emitter
 * modify from mitt
 */ class EventEmitter {
    handlersMap = Object.create(null);
    on(type, handler) {
        if (!this.handlersMap[type]) {
            this.handlersMap[type] = [];
        }
        this.handlersMap[type].push(handler);
        return this;
    }
    off(type, handler) {
        if (this.handlersMap[type]) {
            this.handlersMap[type].splice(this.handlersMap[type].indexOf(handler) >>> 0, 1);
        }
        return this;
    }
    emit(type, ...data) {
        if (this.handlersMap[type]) {
            this.handlersMap[type].slice().forEach((handler)=>{
                handler(...data);
            });
        }
        return this;
    }
}
export default EventEmitter;

//# sourceMappingURL=event.emitter.js.map