RxJS implements these operators as empty
, never
, and throw
.
var source = Rx.Observable.empty(); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
// This will never produce a value, hence never calling any of the callbacks var source = Rx.Observable.never(); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
var source = Rx.Observable.return(42) .selectMany(Rx.Observable.throw(new Error('error!'))); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
empty
is found in the following distributions:
rx.js
rx.all.js
rx.all.compat.js
rx.compat.js
rx.lite.js
rx.lite.compat.js
never
is found in the following distributions:
rx.js
rx.compat.js
rx.lite.js
rx.lite.compat.js
throw
is found in the following distributions:
rx.js
rx.all.js
rx.compat.js
rx.lite.js
rx.lite.compat.js
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4