Created
February 21, 2018 15:37
-
-
Save jdjuan/634d0b5998937a413834599de8201592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { paint } from './canvas.js'; | |
const { fromEvent } = Rx.Observable; | |
const { skipUntil, takeUntil } = Rx.operators; | |
const move$ = fromEvent(document, 'mousemove'); | |
const down$ = fromEvent(document, 'mousedown') | |
const up$ = fromEvent(document, 'mouseup') | |
const paints$ = move$.pipe( | |
skipUntil(down$), | |
takeUntil(up$) | |
); | |
paints$.subscribe(paint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment