Skip to main content

CommonKey

Namespace with helper functions for validating key presses.

Index

Variables

readonlyALT

ALT: 1 = 1

Bitmask component for the KeyboardEvent.altKey modifier

readonlyCTRL

CTRL: 2 = 2

Bitmask component for the KeyboardEvent.ctrlKey modifier

readonlyMETA

META: 4 = 4

Bitmask component for the KeyboardEvent.metaKey modifier

readonlySHIFT

SHIFT: 8 = 8

Bitmask component for the KeyboardEvent.shiftKey modifier

Functions

readonlyGetModifiers

  • GetModifiers(event: KeyboardEvent): number
  • Parameters

    • event: KeyboardEvent

    Returns number

readonlyIsPressed

  • IsPressed(event: KeyboardEvent, key: string, modifiers?: number): boolean
  • Parameters

    • event: KeyboardEvent
    • key: string
    • modifiers: number = null

    Returns boolean