Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromEventPattern does not pass multiple arguments from event callbacks #3048

Closed
raycarter opened this issue Nov 5, 2017 · 2 comments
Closed

Comments

@raycarter
Copy link

RxJS version:
5.5.2
Code to reproduce:

const EventEmitter = require('events').EventEmitter;
const Observable = require('rxjs').Observable;

const emitter = new EventEmitter();

const obs = Observable.fromEventPattern(function(handler) {
  emitter.on('test', handler);
});

obs.subscribe(args => {
  console.log(args); // 'a', expected ['a', 'b', 'c']
});

emitter.emit('test', 'a', 'b', 'c');

Expected behavior:
A group of arguments is expected in subscribe (here expected ['a', 'b', 'c']).
Actual behavior:
Only the first argument is emtted (here 'a').
Additional information:
I think it could be common to create Observables from events and a lot of events pass more than one arguments in its callback functions. It is useful to let rxjs collect all of the arguments and pass them to subscribe. If I am wrong here about how to use rxjs in this situation, please give me a hint how I should do it correctly or which other operators should be used for events with multiple arguments. Thanks a lot!

@kwonoj
Copy link
Member

kwonoj commented Nov 5, 2017

dupe of #2431.

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants