class EventBus {
    emits: Map<string, Function> = new Map<string, Function>();

    on(name: string, callback: Function) {
        this.emits.set(name, callback);
    };

    off(name: string) {
        this.emits.delete(name);
    };

    emit(name: string, ...arg: any[]) {
        if (this.emits.has(name)) {
            let cb = this.emits.get(name)
            return cb!(...arg)
        }
    };
}

export default EventBus
