Reactive-Extensions / rx.angular.js

AngularJS Bindings for RxJS
Other
827 stars 89 forks source link

$eventToObservable example references old version of API #140

Open robations opened 8 years ago

robations commented 8 years ago

https://github.com/Reactive-Extensions/rx.angular.js/tree/master/docs#eventtoobservableeventname

I'm in the process of upgrading from an earlier version of the component. After cross-checking in the source code, I see that if you want to use data.event or data.additionalArguments you need to pass in a "selector" function that maps the event arguments to an object of this type:

function mapEvent() {
    return {
        "event": arguments[0],
        "additionalArguments": Array.prototype.slice.call(arguments, 1)
    };
}

I also noticed that the JSDoc explicitly says that the event name is the only argument to be provided, although it is possible to pass the selector function. I initially thought this was an internal API, but I think perhaps the JSDoc is out of sync?