doc/api/core/operators/toasync.md
Rx.Observable.toAsync(func, [context], [scheduler])Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
func (Function): Function to convert to an asynchronous function.[context] (Any): The context for the func parameter to be executed. If not specified, defaults to undefined.[scheduler=Rx.Scheduler.timeout] (Scheduler): Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.(Function): Asynchronous function.
var func = Rx.Observable.toAsync(function (x, y) {
return x + y;
});
// Execute function with 3 and 4
var source = func(3, 4);
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x);
},
function (err) {
console.log('Error: ' + err);
},
function () {
console.log('Completed');
});
// => Next: 7
// => Completed
File:
Dist:
Prerequisites:
rx.async.js | rx.async.compat.jsrx.js | rx.compat.jsrx.binding.jsNPM Packages:
NuGet Packages:
rxJS-BindingUnit Tests: