nock / propagate

Propagate events from one event emitter into another

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Event emit on destination before original object?

marcofanch opened this issue · comments

Hi, I found this module interesting, which doesn't do actual .on() for the propagation, at the end saved many unnecessary listeners.

One question I want to ask is, why the events are emitted from the destination object before the original?

Under the concept of "propagation", the event should be emitted one after another, started from the source.

Did I misunderstand the concept or your implementation?

Propagate emits on the destination before emitting on the source.
This behavior works for the use cases I was using this for.

(If you need to change this or make this optional, I can take a look at a PR.)

A very simple change, just reverse the invocation order.
This is more intuitive because if the source didn't emit, the dest shouldn't emit.

Please see if this still work for your use case.
Thanks.

@marcofanch thanks!

Landed on v1.0.0.