Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MouseOverComponent extends React.Component {
- componentDidMount() {
- this.mouseMove$ = Rx.Observable.fromEvent(this.mouseDiv, "mousemove")
- .throttleTime(1000)
- .subscribe(() => console.log("throttled mouse move"));
- }
- componentWillUnmount() {
- this.mouseMove$.unsubscribe();
- }
- render() {
- return (
- <div ref={(ref) => this.mouseDiv = ref}>
- Move the mouse and look at the console...
- </div>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement