chrisdavies / eev

A tiny, fast, zero-dependency event emitter
522 stars 32 forks source link

TypeScript: Make eev.js interoperable with RxJS #19

Open fmqa opened 3 years ago

fmqa commented 3 years ago

It would be great if Eev would support easy interoperability with RxJS fromEvent https://rxjs-dev.firebaseapp.com/api/index/function/fromEvent

Currently, the only difficulty seems to be a minor type mismatch in the on / off function signatures, which do not quite match JQueryStyleEventEmitter.

changing

        on(names: string, fn: CallbackFunction): void;
        off(names: string, fn: CallbackFunction): void;

to

        on(names: string, fn: Function): void;
        off(names: string, fn: Function): void;

in eev.d.ts would fix this and allow easy conversion of events to Observables through fromEvent.