Skip to content

Moh-Snoussi/keyboard-event-key-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keyboard Event Key Types

Description

A simple Typescript package that contains the types of the keyboard-event-key as string-literals like: ArrowDown, ArrowUp and so on.

Getting Started

Installing

npm install --save keyboard-event-key-type

Usage

document.addEventListener('keydown', function ( event ) {
    const actualKey = <KeyboardEventKey>event.key
    const actionKey : KeyboardEventKey = "ArrowDown" // <- intellisense
    if (actualKey === actionKey) {
        // clicked !
    }
})

IntelliSense

The package mainly helps with the IDE-IntelliSense: Alt text

Supported types

All keys are taken from developer.mozilla.KeyboardEvent.Keys as of 11/19/2021, with additional support to custom keys.

  • NumericKeypadKeys
  • UpperAlpha
  • LowerAlpha
  • ModifierKeys
  • WhitespaceKeys
  • NavigationKeys
  • EditingKeys
  • UIKeys
  • DeviceKeys
  • IMECompositionKeys
  • LinuxDeadKeys
  • FunctionKeys
  • PhoneKeys
  • MultimediaKeys
  • TVControlKeys
  • MediaControllerKeys
  • SpeechRecognitionKeys
  • DocumentKeys
  • ApplicationSelectorKeys
  • BrowserControlKeys
  • KoreanKeyboardsOnly
  • DeprecatedWhitespaceKey
  • SpecialValueKey
  • CustomValueKey

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published