'How to emit when events stop coming?
I have Observable from an event of the mouse move.
I want to react when the mouse stops moving - meaning when events from Observable stop coming...
How do I do that?
Solution 1:[1]
You can use fromEvent to watch for mousemove on the document. Then use debounceTime within a pipe to wait for the mouse movement to stop.
fromEvent(document, 'mousemove')
.pipe(debounceTime(2000))
.subscribe(() => console.log('Mouse Stopped: No movement for 2s'));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
