MCPcopy Create free account
hub / github.com/apache/cloudstack / _getKeyCode

Method _getKeyCode

systemvm/agent/noVNC/core/input/keyboard.js:56–85  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

54 }
55
56 _getKeyCode(e) {
57 const code = KeyboardUtil.getKeycode(e);
58 if (code !== 'Unidentified') {
59 return code;
60 }
61
62 // Unstable, but we don't have anything else to go on
63 if (e.keyCode) {
64 // 229 is used for composition events
65 if (e.keyCode !== 229) {
66 return 'Platform' + e.keyCode;
67 }
68 }
69
70 // A precursor to the final DOM3 standard. Unfortunately it
71 // is not layout independent, so it is as bad as using keyCode
72 if (e.keyIdentifier) {
73 // Non-character key?
74 if (e.keyIdentifier.substr(0, 2) !== 'U+') {
75 return e.keyIdentifier;
76 }
77
78 const codepoint = parseInt(e.keyIdentifier.substr(2), 16);
79 const char = String.fromCharCode(codepoint).toUpperCase();
80
81 return 'Platform' + char.charCodeAt();
82 }
83
84 return 'Unidentified';
85 }
86
87 _handleKeyDown(e) {
88 const code = this._getKeyCode(e);

Callers 2

_handleKeyDownMethod · 0.95
_handleKeyUpMethod · 0.95

Calls 1

getKeycodeMethod · 0.80

Tested by

no test coverage detected