Skip to content

Instantly share code, notes, and snippets.

@drifterz28
Created November 8, 2019 06:36
Show Gist options
  • Save drifterz28/5bde745a814a2cb2b72ec851759bbbd7 to your computer and use it in GitHub Desktop.
Save drifterz28/5bde745a814a2cb2b72ec851759bbbd7 to your computer and use it in GitHub Desktop.
const P_KEY_CODE = 80;
const handleKeyPress = e => {
if (e.shiftKey && e.keyCode === P_KEY_CODE) {
togglePrefs(!showConsolePrefs);
}
};
window.addEventListener('keydown', handleKeyPress);
return () => {
window.removeEventListener('keydown', handleKeyPress);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment