MCPcopy Index your code
hub / github.com/autoNumeric/autoNumeric / keyCodeNumber

Method keyCodeNumber

src/AutoNumericHelper.js:347–351  ·  view source on GitHub ↗

* Return the code for the key used to generate the given event. * * @param {Event} event * @returns {string|Number}

(event)

Source from the content-addressed store, hash-verified

345 * @returns {string|Number}
346 */
347 static keyCodeNumber(event) {
348 // `event.keyCode` and `event.which` are deprecated, `KeyboardEvent.key` (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) must be used now
349 // Also, do note that Firefox generate a 'keypress' event (e.keyCode === 0) for the keys that do not print a character (ie. 'Insert', 'Delete', 'Fn' keys, 'PageUp', 'PageDown' etc.). 'Shift' on the other hand does not generate a keypress event.
350 return (typeof event.which === 'undefined')?event.keyCode:event.which;
351 }
352
353 /**
354 * Return the character from the event key code.

Callers 1

characterMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected