Skip to content

Instantly share code, notes, and snippets.

@MylesBorins
Created January 13, 2017 17:48
Show Gist options
  • Select an option

  • Save MylesBorins/f06c8f4647f1c2556df36e671ec628e2 to your computer and use it in GitHub Desktop.

Select an option

Save MylesBorins/f06c8f4647f1c2556df36e671ec628e2 to your computer and use it in GitHub Desktop.
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