I have a node.js EventEmitter which raises the following events: error
, message
.
Is there a straight forward way I can create an RxJS Observable from it?
i.e next()
called on message
and error()
called on error
.
I have a node.js EventEmitter which raises the following events: error
, message
.
Is there a straight forward way I can create an RxJS Observable from it?
i.e next()
called on message
and error()
called on error
.
You can create it like this:
As an alternative, you can do this by constructinng and chaining observables like this, but it's clearly less readable: