Function from
will turn an iterable
, Promise
, or Observable-like
value into an Observable. Examples using iterable
:
A stream from an Array
1234567const { rxObserver } = require('api/v0.3'); const { from } = require('rxjs'); from([ 5, 10, 20 ]) .subscribe(rxObserver('from([5, 10, 20])'));
A stream from a String
1234567const { rxObserver } = require('api/v0.3'); const { from } = require('rxjs'); from('Hello') .subscribe(rxObserver(`from('Hello')`));
For promise conversion example see fromPromise