( StackBlitz | jsBin | jsFiddle )
// RxJS v6+
import { fromEvent } from 'rxjs';
import { map } from 'rxjs/operators';
//create observable that emits click events
const source = fromEvent(document, 'click');
//map to string with given event timestamp
const example = source.pipe(map(event => `Event time: ${event.timeStamp}`));
//output (example): 'Event time: 7276.390000000001'
const subscribe = example.subscribe(val => console.log(val));
- Alphabet Invasion Game
- Battleship Game
- Breakout Game
- Car Racing Game
- Catch The Dot Game
- Click Ninja Game
- Flappy Bird Game
- Game Loop
- Horizontal Scroll Indicator
- HTTP Polling
- Lockscreen
- Memory Game
- Mine Sweeper Game
- Platform Jumper Game
- Progress Bar
- Save Indicator
- Smart Counter
- Space Invaders Game
- Stop Watch
- Swipe To Refresh
- Tank Battle Game
- Tetris Game
- Type Ahead
- Uncover Image Game
- fromEvent 📰 - Official docs
📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/fromEvent.ts