take(N)
will take maximum N
values from the source stream and will complete after that
Also check out this
first
vstake
vssingle
head-to-head comparison
12345678910111213const { rxObserver } = require('api/v0.3'); const { timer } = require('rxjs'); const { take } = require('rxjs/operators'); const source$ = timer(0, 100); const result$ = source$.pipe( take(5) ); source$.subscribe(rxObserver('source')); result$.subscribe(rxObserver('take(5)'));
⚠️ Execution time is limited to 1000ms