Open
Description
The issue is that if the listen()
is called multiple times. The callback
gets overwritten but , we now have two onData
events registered.
The proposal to change is this, so that onData
is registered on the reader when the instance is created, and not on listen
. Also, the dispose removes callback, and not the onData
handler.
For efficiency, we don't need to process data unless there is a listener on. So, adding a isEmpty
to the Emitter
, and using emitter to manage callbacks and cleanup.