How to use rx

Comprehensive rx code examples:

How to use rx.throw:

19
20
21
22
23
24
25
26
27
28
29
30
function successValue () {
  return Observable.return([1, 2, 3])
}


function failure () {
  return Observable.throw(new Error('observable error'))
}


test('should handle a finished empty observable', function (done) {
  merz(success)(function (err, res) {

How to use rx.empty:

11
12
13
14
15
16
17
18
19
20
21
22
var test = require('assertit')
var Observable = require('rx').Observable
var merz = require('../index')


function success () {
  return Observable.empty()
}


function successValue () {
  return Observable.return([1, 2, 3])

How to use rx.return:

15
16
17
18
19
20
21
22
23
24
25
26
function success () {
  return Observable.empty()
}


function successValue () {
  return Observable.return([1, 2, 3])
}


function failure () {
  return Observable.throw(new Error('observable error'))