Press "Enter" to skip to content

Global Keyboard Shortcut Event Handler | Shortcut.js

Shortcut.js is a JavaScript ES6 component that provides a global keyboard event handler. This way one can announce and interact with any combination of keys. It also provides several useful methods for handling registered keyboard events.

With ~ 5Ko Mini, Shortcut.js is designed to be stable and stay as light as possible. It should be used widely so that all of your components can interact with keyboard events.

How to make use of it:

1. Download and import the Shortcut.js as an ES module.

import Shortcut from './src/Shortcut.js';

2. Initialize the Shortcut.js and we’re able to go.

const myShortCuts = new Shortcut({
      // options here

3. Register shortcuts as follows:

myShortCuts.register('B', () => {
  // triggered when you press B

myShortCuts.register('Ctrl+F', () => {
  // triggered when you press Ctrl+F

4. Unregister shortcuts utilizing the remove technique.


5. Determine the important thing event to react from. Default: ‘keydown’.

const myShortCuts = new Shortcut({
      keyEvent: 'keyup'

6. Determine whether or not to auto-repeat the event if the secret’s held on.

const myShortCuts = new Shortcut({
      autoRepeat: false

7. You may also pause & resume the shortcuts utilizing the next methods:


Create Custom Key Binding Events, Shortcut JS Plugin/Github

See Demo And Download

Official Website(ArthurBeaulieu): Click Here

This superior jQuery/javascript plugin is developed by ArthurBeaulieu. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.