Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fromEvent): Aggregate multiple arguments
If provided with an EventEmitter, `fromEvent` streams will emit an array of values when the EventEmitter provides listeners with multiple arguments. The previous implementation naively provided only the first argument, which made `fromEvent` incompatible with event interfaces that rely on providing multiple arguments to their listeners, such as Node's `http.Server`. An alternative solution involved providing selector support. This wasn't implemented for several reasons. 1. Modifying the function signature for the extra would be a breaking change. 2. An expanded function signature would become 'crowded', and one of the architectural goals of xstream is to keep interfaces as small as they need to be to achieve their goals. 3. Aggregating emitted events into an array is consistent with the implementation in Most.js, and achieves similar flexibility with Rx when providing a selector function to `.map()` on a result stream. `fromEvent` will now emit mixed-types. If consumers are not responsible for calling `.emit()` on the source emitter, they should implement appropriate guards to ensure they are dealing with an intended type. Should resolve staltz#84.
- Loading branch information