skip to content

tap

 

with tap you can perform side-effects when source emits, errors or completes

Open browser console to see the output

1
2
3
4
5
6
7
8
9
10
11
12
const { rxObserver } = require('api/v0.3');
const { timer } = require('rxjs');
const { tap, take } = require('rxjs/operators');

timer(0, 5)
  .pipe(
    take(10),
    tap(v => console.log('tap', v))
  )
  .subscribe(rxObserver('tap()'));

0mstap()startcomplete00 11 22 33 44 55 66 77 88 99

See tap vs finalize comparison