@archivistnerd/onkeypress
v1.0.5
Published
Archivist's onkeypress Package
Downloads
12
Readme
node-onkeypress
Archivist Nerd's onkeypress Package
Calls a callback function after key has been pressed (terminal)
Installation
npm install --save @archivistnerd/onkeypress
Usage
'use strict';
const onKeypress = require('@archivistnerd/onkeypress');
process.stdout.write(`Test: onKeypress (Package)\n`)
onKeypress( ()=>{
process.stdout.write(`Closing\n`)
process.exit(0)
})
Note
You can change the message as well by providing it as a second argument.
'use strict';
const onKeypress = require('@archivistnerd/onkeypress');
process.stdout.write(`Test: onKeypress (Package)\n`)
onKeypress( ()=>{
process.stdout.write(`Closing\n`)
process.exit(0)
}, 'I will close after you press a key...')
License
MIT