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.
Arguments
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.
Returns
(Function): Asynchronous function.
Example
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
Location
File:
Dist:
Prerequisites:
rx.async.js | rx.async.compat.jsrx.js|rx.compat.jsrx.binding.js
NPM Packages:
NuGet Packages:
rxJS-Binding
Unit Tests: