Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
56 lines (42 loc) · 2.13 KB

wrap.md

File metadata and controls

56 lines (42 loc) · 2.13 KB

Rx.Observable.wrap(fn)

Wrap the given generator fn into a function that returns an Observable.

Arguments

  1. fn (Function): A generator function to wrap.

Returns

(Function): A function once executed, returns an Observable.

Example

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

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: