Wrap the given generator fn
into a function that returns an Observable.
fn
(Function
): A generator function to wrap.
(Function
): A function once executed, returns an Observable.
var Rx = require('rx');
var fn = Rx.Observable.wrap(function* (val) {
return yield Rx.Observable.just(val);
});
fn(42).subscribe(
function (x) { console.log('next %s', x); },
function (e) { console.log('error %s', e); },
function () { console.log('completed'); }
);
// => next 42
// => completed
File:
Dist:
Prerequisites:
- If using
rx.async.js
|rx.async.compat.js
rx.lite.js
|rx.lite.compat.js
NPM Packages:
NuGet Packages:
Unit Tests: