Cancel an observable created with “fromEvent” and switch to a new one
问题 My goal is to emit "hi again" in 1 second interval until a key is pressed and continue whenever there is a mouse click. Here is my code: import { of, fromEvent, interval } from 'rxjs'; import { map, tap, takeUntil,take, repeatWhen, shareReplay, switchMap , takeLast} from 'rxjs/operators'; const fromKeyUp$ = fromEvent(window, 'keyup').pipe(tap(_=> console.log('keyup'))); const fromMouseUp$ = fromEvent(window, 'mouseup').pipe(tap(_=> console.log('mouseup'))); const source = interval(1000).pipe