Last active
May 20, 2016 19:34
-
-
Save griffinmichl/876b079cf19404d8073f2214a2458ee5 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
function getCharInRange(first, last) { | |
const charactersInRange = R.compose(R.map(keycode), R.range) | |
return charactersInRange(first, last) | |
} | |
const keystroke$ = getCharInRange(65, 91).reduce((acc$, char) => | |
acc$.merge(Observable.zip( | |
DOM | |
.select(':root') | |
.events('keydown') | |
.map(eventToObject) | |
.filter(obj => obj.key === char), | |
DOM | |
.select(':root') | |
.events('keyup') | |
.map(eventToObject) | |
.filter(obj => obj.key === char) | |
)), Observable.empty()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment