Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #49 from lukehb/fix-keycodes
Browse files Browse the repository at this point in the history
Fix bug when negating property in and removing duplicate property
  • Loading branch information
Belchy06 committed Nov 24, 2022
2 parents a759cc3 + eabd3c0 commit 9004426
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions SignallingWebServer/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2538,7 +2538,6 @@ const CodeToKeyCode = {
"NumLock": 144,
"ControlRight": 254,
"AltRight": 255,
"Pause": 19,
"Home": 36,
"End": 35,
"ArrowUp": 38,
Expand All @@ -2557,7 +2556,7 @@ function getKeyCode(e) {

// If we don't have keyCode property because browser API is deprecated then use KeyboardEvent.code instead.
// See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#constants_for_keycode_value
if(!"keyCode" in e) {
if(!("keyCode" in e)) {
// Convert KeyboardEvent.code string into integer-based key code for backwards compatibility reasons.
if(e.code in CodeToKeyCode) {
return CodeToKeyCode[e.code];
Expand Down Expand Up @@ -2620,7 +2619,7 @@ function registerKeyboardEvents() {
};

document.onkeypress = function(e){
if(!"charCode" in e){
if(!("charCode" in e)){
console.warn("KeyboardEvent.charCode is deprecated in this browser, cannot send key press.");
return;
}
Expand Down

0 comments on commit 9004426

Please sign in to comment.