toPromise
signature: toPromise() : Promise
toPromise() : Promise옵저버블을 프로미스로 바꾸어줍니다.
예시
//옵저버블을 리턴
const sample = val => Rx.Observable.of(val).delay(5000);
//옵저버블을 프로미스로 변환
const example = sample('First Example')
.toPromise()
//결과: 'First Example'
.then(result => {
console.log('From Promise:', result);
});추가 자료
Last updated
Was this helpful?