IxJS icon indicating copy to clipboard operation
IxJS copied to clipboard

Doc: Add Observable to ObservableAsyncIterable conversion to the examples.

Open ghuser opened this issue 5 years ago • 2 comments

IxJS version:

3.0.1

Code to reproduce:

Expected behavior:

Actual behavior:

Additional information:

From what I've seen one of the features of ix is to be able to convert an existing Observable to a FromObservableAsyncIterable which can be used in for await loop. This is done if we pass an observable to the from() method.

e.g.

const Rx = require('rxjs');
const aiRx= require('ix/asynciterable');
const {from,delay,concatMap} = Rx;
const aiFrom = aiRx.from;

const someObservable = from(["first Value","second value","third vlaue","fourth value","fifth value"])
.pipe(concatMap((v)=>of(v).pipe(delay(Math.random()*1000)) ))

  (async function() {
     for await (let num of aiFrom(someObservable)) {
       console.log(num);
     }
  })();

Shouldn't such an example be added to the doc, or is it not officially supported?

ghuser avatar Feb 24 '20 15:02 ghuser

Great question. Did it get added?

timcash avatar Aug 27 '20 22:08 timcash

@timcash Yes, I believe we have this tested here.

trxcllnt avatar Aug 31 '20 21:08 trxcllnt