Home / Function/ KeyboardEventInterface.which() — react Function Reference

KeyboardEventInterface.which() — react Function Reference

Architecture documentation for the KeyboardEventInterface.which() function in SyntheticEvent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6675417a_c4d4_dd84_dad4_5b1332d50358["KeyboardEventInterface.which()"]
  9c3d71d9_41af_c5e7_cd35_d25bbf6cf606["SyntheticEvent.js"]
  6675417a_c4d4_dd84_dad4_5b1332d50358 -->|defined in| 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606
  e465f930_ff45_eb24_125c_d4942d1fa85f["getEventCharCode()"]
  6675417a_c4d4_dd84_dad4_5b1332d50358 -->|calls| e465f930_ff45_eb24_125c_d4942d1fa85f
  style 6675417a_c4d4_dd84_dad4_5b1332d50358 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/events/SyntheticEvent.js lines 485–498

  which: function (event: {[propName: string]: mixed}) {
    // `which` is an alias for either `keyCode` or `charCode` depending on the
    // type of the event.
    if (event.type === 'keypress') {
      return getEventCharCode(
        // $FlowFixMe[incompatible-call] unable to narrow to `KeyboardEvent`
        event,
      );
    }
    if (event.type === 'keydown' || event.type === 'keyup') {
      return event.keyCode;
    }
    return 0;
  },

Domain

Subdomains

Frequently Asked Questions

What does KeyboardEventInterface.which() do?
KeyboardEventInterface.which() is a function in the react codebase, defined in packages/react-dom-bindings/src/events/SyntheticEvent.js.
Where is KeyboardEventInterface.which() defined?
KeyboardEventInterface.which() is defined in packages/react-dom-bindings/src/events/SyntheticEvent.js at line 485.
What does KeyboardEventInterface.which() call?
KeyboardEventInterface.which() calls 1 function(s): getEventCharCode.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free