npm.io
0.1.3 • Published 2 years ago

keyboard-shortcut-listener-helper

Licence
ISC
Version
0.1.3
Deps
2
Size
4 kB
Vulns
0
Weekly
0
Stars
2

keyboard-shortcut-listener-helper

A utility library for easily listening to complex keyboard shortcuts in web applications.

Installation

Install keyboard-shortcut-listener-helper using npm:

npm install keyboard-shortcut-listener-helper

Usage

To use this library, first import and instantiate KeyboardShortcutListenerHelper, then use registerShortcut to listen for specific keyboard shortcuts.

const KeyboardShortcutListenerHelper = require('keyboard-shortcut-listener-helper');
const listener = new KeyboardShortcutListenerHelper();

// Register a shortcut: Ctrl+Shift+A
listener.registerShortcut('ctrl+shift+a', () => {
  console.log('Shortcut Ctrl+Shift+A was pressed!');
});

Dependencies

  • lodash: A modern JavaScript utility library delivering modularity, performance & extras.
  • eventemitter3: A high performance EventEmitter.

Keywords