Skip to content

Commit

Permalink
Check to see if KeyboardEvent.code is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffposnick committed Apr 14, 2016
1 parent e81d4f4 commit 3c30fb5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion keyboardevent-code-attribute/demo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
window.addEventListener('keydown', function(event) {
ChromeSamples.log('KeyboardEvent.code:', event.code);
if ('code' in event) {
ChromeSamples.log('KeyboardEvent.code:', event.code);
} else {
ChromeSamples.setStatus('KeyboardEvent.code is not supported.');
}
});

0 comments on commit 3c30fb5

Please sign in to comment.