New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

keylogic

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

keylogic

A frontend JavaScript package for managing keyboard shortcuts/events.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

keylogic

A frontend JavaScript package for managing keyboard shortcuts/events.

📦 Installation

npm install keylogic --save

🚀 Usage

Creating a keyboard shortcut:

createKeyShortcut(callback, ...keys)

// Being a default export, you can name this function whatever you want.
import createKeyShortcut from "keylogic";

// The first argument is a callback function for when the shortcut is pressed, and the rest define the keybinds.
const myShortcut = createKeyShortcut(
  (event) => {
    /* Your callback */
  },
  "control",
  "alt",
  "a"
);

// To unbind the shortcut, simply call:
myShortcut.unbind();

// To re-bind it later:
myShortcut.bind();

⚠️ When calling createKeyShortcut, always use the key name(event.key), not the key code or any other identifier. Created shortcuts will attempt to block a default shortcut in your browser, if present.

🗝️ Supported Key Names

  • Letters: a-z

  • Numbers: 0-9

  • Modifier keys: control, alt, shift, meta (Windows key, Command key, Chromebook search key)

  • Other common keys:

    • capslock

    • tab

    • enter

    • escape

    • backspace

    • arrowup, arrowdown, arrowleft, arrowright

Credits

Everything by Jacob Hackney.

FAQs

Package last updated on 02 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts