Advertisement
codergautamyt

nodekeypress.js

Jan 24th, 2022
1,947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const readline = require('readline');
  2.  
  3. readline.emitKeypressEvents(process.stdin);
  4. if (process.stdin.isTTY) process.stdin.setRawMode(true);
  5.  
  6. // listen to keypress
  7.  
  8. process.stdin.on("keypress", (str, key) => {
  9.     if(key.ctrl && key.name == "s") console.log("save")
  10. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement