(code: string)
| 1108 | } |
| 1109 | |
| 1110 | function physicalKeyFromCode(code: string): string | null { |
| 1111 | if (/^Key[A-Z]$/.test(code)) return code.slice(3); |
| 1112 | if (/^Digit\d$/.test(code)) return code.slice(5); |
| 1113 | if (/^Numpad\d$/.test(code)) return code.slice(6); |
| 1114 | switch (code) { |
| 1115 | case "Minus": |
| 1116 | return "-"; |
| 1117 | case "Equal": |
| 1118 | return "="; |
| 1119 | case "BracketLeft": |
| 1120 | return "["; |
| 1121 | case "BracketRight": |
| 1122 | return "]"; |
| 1123 | case "Backslash": |
| 1124 | return "\\"; |
| 1125 | case "Semicolon": |
| 1126 | return ";"; |
| 1127 | case "Quote": |
| 1128 | return "'"; |
| 1129 | case "Comma": |
| 1130 | return ","; |
| 1131 | case "Period": |
| 1132 | return "."; |
| 1133 | case "Slash": |
| 1134 | return "/"; |
| 1135 | case "Backquote": |
| 1136 | return "`"; |
| 1137 | case "NumpadAdd": |
| 1138 | return "+"; |
| 1139 | case "NumpadSubtract": |
| 1140 | return "-"; |
| 1141 | case "NumpadMultiply": |
| 1142 | return "*"; |
| 1143 | case "NumpadDivide": |
| 1144 | return "/"; |
| 1145 | case "NumpadDecimal": |
| 1146 | return "."; |
| 1147 | default: |
| 1148 | return null; |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | /** |
| 1153 | * Resolve the binding key from a KeyboardEvent. |
no outgoing calls
no test coverage detected