Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between bindCallback and bindNodeCallback in RxJs API?

Tags:

rxjs

I want to know what is the difference between bindCallback and bindNodeCallback methods, in RxJs API; and how to know when use one or another.

Thanks alot!

like image 300
Vladimir Venegas Avatar asked Dec 17 '16 20:12

Vladimir Venegas


1 Answers

The only difference is that Node callbacks always take an error as the first parameter. From the documentation for bindNodeCallback:

The callback function is expected to follow Node.js conventions, where the first argument to the callback is an error, while remaining arguments are the callback result.

RxJS will take this into account and will wire up the callback's error parameter to the observable's error notification mechanism. That's not possible with bindCallback, as there is no convention for the parameters.

like image 192
cartant Avatar answered Nov 02 '22 06:11

cartant