rxjs - is Observable.toPromise and Observable.last().subscribe are identical -
are 2 line of code identical in performance
observable.range(1,5).topromise().then(res => console.log(res))
vs
observable.range(1,5).last().subscribe(res => console.log(res))
if the documentation of topromise()
find identical
return new promise((resolve, reject) => { let value; this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value)); });
Comments
Post a Comment