fromEvent
operator Converts Event
to observable stream
This example you need click in the page:
import { fromEvent } from 'rxjs';
const clicks$ = fromEvent(document, 'click');
press the keyboard
import { fromEvent } from 'rxjs';
import { map } from 'rxjs/operators';
const keyDown$ = fromEvent(document, "keydown")
.pipe(map(e => e.key));
Official Doc: rxjs.fromEvent