Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace KeyCode

Index

Type Aliases

Predicate: ((keyCode: KeyCode) => boolean)

Type declaration

    • Determines a true of false value for the key code argument.

      Parameters

      Returns boolean

Functions

  • isKeyboardEvent(event: object & { type?: string }): event is KeyboardEvent
  • Different scopes have different execution environments. This means that they have different built-ins (different global object, different constructors, etc.). This may result in unexpected results. For instance, [] instanceof window.frames[0].Array will return false, because Array.prototype !== window.frames[0].Array and arrays inherit from the former. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof

    Note: just add another check if the current event.type checking is insufficient.

    Parameters

    • event: object & { type?: string }

    Returns event is KeyboardEvent

  • isModifierString(key: string): boolean
  • toCharacter(event: KeyboardEvent): string | undefined
  • Determine the actual printable character that is generated from a pressed key. If the key does not correspond to a printable character, undefined is returned. The result may be altered by modifier keys.

    Parameters

    • event: KeyboardEvent

    Returns string | undefined

  • toKey(event: KeyboardEvent, dispatch?: "code" | "keyCode"): Key