0.5.1 • Published 1 year ago

shortkut v0.5.1

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

Shortkut - A simple, lightweight JS library to listen to keyboard shortcuts.

Why?

For a recent project of mine, I was looking for a simple way to listen to keyboard shortcuts (various combinations of valid keys). I was unable to find one that wasn't 6 years old. So I created my own.

Features

  • Simple pattern for defining key combinations. For example 'control+meta+/'.
  • Isolated contexts (PR welcome).
  • Non-browser support (PR welcome).

usage

import shortkut from 'shortkut'

const doSomething = () => {
	// something
}

shortkut('meta+shift+z', doSomething)

notes

  • Case insensitive.
  • Order insensitive.