Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class MouseOverComponent extends React.Component {
  2.  
  3. componentDidMount() {
  4. this.mouseMove$ = Rx.Observable.fromEvent(this.mouseDiv, "mousemove")
  5. .throttleTime(1000)
  6. .subscribe(() => console.log("throttled mouse move"));
  7. }
  8.  
  9. componentWillUnmount() {
  10. this.mouseMove$.unsubscribe();
  11. }
  12.  
  13. render() {
  14. return (
  15. <div ref={(ref) => this.mouseDiv = ref}>
  16. Move the mouse and look at the console...
  17. </div>
  18. );
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement