This is RxJS v 4. Find the latest version here
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.js
rx.binding.js
NPM Packages:
NuGet Packages:
rx
JS-Binding
Unit Tests: