Skip to content

Instantly share code, notes, and snippets.

@mrkacan
Created April 20, 2018 07:24
Show Gist options
  • Save mrkacan/168dfe39744434f039048a011f0a12d1 to your computer and use it in GitHub Desktop.
Save mrkacan/168dfe39744434f039048a011f0a12d1 to your computer and use it in GitHub Desktop.
Javascript escape shortcuts listener
window.addEventListener('keydown', (keyboardEvent) => {
if ((keyboardEvent.key === "Escape" || keyboardEvent.key === "Esc")) {
//Do something...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment