Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. const {stdin, setRawMode} = useContext(StdinContext);
  2.  
  3. useEffect(() => {
  4. setRawMode(true);
  5.  
  6. const handleInput = key => {
  7. const direction = keyToDirection(key);
  8. if (direction) {
  9. state.chosenDirection = direction;
  10. }
  11. };
  12. stdin.on('data', handleInput);
  13. return () => stdin.removeListener('data', handleInput);
  14. }, []);
  15.  
  16. // {...}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement