/key-string

Detect keyboard event type from KeyboardEvent.

Primary LanguageJavaScriptMIT LicenseMIT

key-string

Detect keyboard event type from KeyboardEvent.

Install

npm install key-string

Usage

import KeyStringDetector from 'key-string'

const detector = new KeyStringDetector();

document.addEventListener('keydown', (event) => {
  console.log(detector.detect(event)); //=> "Alt+Ctrl+Return"
});

Import

Import in your favorite style.

// Pattern 1: Using a default export
import KeyStringDetector from 'key-string'

// Pattern 2: Using named exports
import { KeyStringDetector, keyStringMap } from 'key-string'

// Pattern 3: Using both a default export and named exports
import KeyStringDetector, { keyStringMap } from 'key-string'

For more details

For contributors

# Set up
npm install

# Compile JavaScript files
npm run compile

# Watch changes of JavaScript files
npm run watch

# Run tests
npm run test

Inspired by