How can I `await` on an Rx Observable?

前端 未结 5 734
孤城傲影
孤城傲影 2020-11-28 04:39

I\'d like to be able to await on an observable, e.g.

const source = Rx.Observable.create(/* ... */)
//...
await source;

A naive attempt res

5条回答
  •  萌比男神i
    2020-11-28 05:25

    You will need to await a promise, so you will want to use toPromise(). See this for more details on toPromise().

提交回复
热议问题