import { endWith, finalize } from 'rxjs/operators';
import { of } from 'rxjs';
const source$ = of('Hello', 'Friend');
endWith('Goodbye', 'Friend'),
// this function is invoked when unsubscribe methods are called
finalize(() => console.log('Finally'))
// 'Hello', 'Friend', 'Goodbye', 'Friend'
.subscribe(val => console.log(val));