View -
1 2 3 4 5 6 7 8 9 10
var Rx = require('rx');
 
var s1 = new Rx.Subject();
var s2 = new Rx.Subject();
var s3 = new Rx.Subject();
 
Rx.Observable.merge(s1, s2, s3).
forEach(
console.log.bind(console, 'next'),
console.log.bind(console, 'error'),
View -
1 2 3 4 5 6 7 8 9 10
var Rx = require('rx');
 
var throwErrors = Rx.Observable.throw(new Error('tiny url exploded'));
 
throwErrors.
do(
function () {},
function () {
console.log('handle error');
}
View -
1 2 3 4 5 6 7 8 9
var Rx = require('rx');
 
var subjects = {};
 
function create(sn) {
 
var s = new Rx.Subject();
 
subjects[sn] = s;
View foo.javascript
1 2 3 4 5 6 7 8 9 10
var Rx = require('rx');
 
var profileSwitchSuccess = new Rx.Subject();
var cacheExpiryInHomeOnForeground = new Rx.Subject();
var loginCheckDone = new Rx.Subject();
 
profileSwitchSuccess.asObservable().
map(function () {
return true;
}).
View foo.javascript
1 2 3 4 5 6 7 8 9 10
var Rx = require('rx');
 
var profileSwitchSuccess = new Rx.Subject();
var cacheExpiryInHomeOnForeground = new Rx.Subject();
var loginCheckDone = new Rx.Subject();
 
profileSwitchSuccess.asObservable().
do(function () {
console.log('profile switch success');
}).
View foo.javascript
1 2 3 4 5 6 7 8 9 10
profileSwitchSuccesses.
startWith(true).
flatMapLatest(function () {
return cacheExpiryInHomeOnForegrounds.
flatMapLatest(function() {
return EventManager.observe(EventManager.APP.EVENT_LOGIN_CHECK_DONE).
take(1).
filter(isLoggedIn);
});
}).
View foo.javascript
1 2 3 4 5 6 7 8 9
var Rx = require('rx');
 
var e1 = new Rx.Subject();
var e2 = new Rx.Subject();
var e3 = new Rx.Subject();
 
var e1s = e1.asObservable();
var e2s = e2.asObservable();
var e3s = e3.asObservable();
View -
1 2 3 4 5 6 7 8 9
var Rx = require('rx');
 
var e1 = new Rx.Subject();
var e2 = new Rx.Subject();
var e3 = new Rx.Subject();
 
var e1s = e1.asObservable();
var e2s = e2.asObservable();
var e3s = e3.asObservable();
View -
1 2 3 4 5 6 7 8 9
var Rx = require('rx');
 
var e1 = new Rx.Subject();
var e2 = new Rx.Subject();
var e3 = new Rx.Subject();
 
var e1s = e1.asObservable();
var e2s = e2.asObservable();
var e3s = e3.asObservable();
View -
1 2 3 4 5 6 7 8 9 10
var Rx = require('rx');
 
var s = new Rx.Subject();
 
var r = s.asObservable().replay();
 
r.connect();
 
s.onNext(1);
s.onNext(2);
Something went wrong with that request. Please try again.