Last updated 5 years ago
Was this helpful?
toArray(): OperatorFunction
예시 1: 시간 간격을 두고 방출되는 값을 모으고, 인터벌이 완료되면 배열형태로 내보냅니다
( )
// RxJS v6+ import { interval } from 'rxjs'; import { toArray, take } from 'rxjs/operators'; interval(100) .pipe( take(10), toArray() ) .subscribe(console.log); // 결과: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
- 공식 문서
Source Code: