Created
January 13, 2017 17:48
-
-
Save MylesBorins/f06c8f4647f1c2556df36e671ec628e2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const readline = require('readline'); | |
| readline.emitKeypressEvents(process.stdin); | |
| process.stdin.setRawMode(true); | |
| process.stdin.on('keypress', (str, key) => { | |
| if (key.ctrl && key.name === 'c') { | |
| process.exit(); | |
| } | |
| else if(key.name === 'space') { | |
| console.log('YOU DID IT') | |
| } | |
| }); | |
| console.log('Press SpaceBar'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment