npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

umbr-key-master

v1.0.5

Published

A lightweight, type-safe TypeScript library for managing complex keyboard shortcuts and multi-key combinations in the browser.

Downloads

628

Readme

KeyMaster

KeyMaster is a TypeScript library for managing complex keyboard shortcuts and key combinations in the browser. It allows you to register callbacks for specific key sequences, supporting all W3C/DOM-standard key values.


Features

  • Multi-Key Support: Listen to single keys or complex combinations (e.g., Ctrl + Shift + S).

  • Standard Compliant: Supports all standard key types defined by the W3C UI Events spec:

  • Alphabet keys (A-Z)

  • Control keys (Enter, Escape, Backspace)

  • Modifier keys (Shift, Ctrl, Alt, Meta)

  • Navigation keys (Arrow keys, Home, End)

  • Function keys (F1-F12)

  • Multimedia & Device keys

  • Contextual Data: Pass custom data or state to your callbacks automatically.

  • Memory Safe: Simple dispose() method to clean up event listeners and prevent memory leaks.


Installation

npm install umbr-key-master

Usage

import { KeyMaster, PressableKey } from "umbr-key-master";

// 1. (Optional) Define a function to provide context/data to your callbacks
const getContext = () => ({ 
  timestamp: Date.now(),
  activeEditor: "main-text-area" 
});

// 2. Initialize KeyMaster
const km = new KeyMaster(getContext);

// 3. Register a key combination (e.g., Shift + A)
// Note: Key strings match W3C "key" values
km.add(["Shift", "a"], (data) => {
  console.log("Combination triggered!", data);
});

// 4. Register a single key callback
km.add(["Enter"], () => {
  console.log("Enter key was pressed");
});

// 5. Removing a callback
const myCallback = () => console.log("Temporary shortcut");
km.add(["Control", "s"], myCallback);

// Later...
km.remove(myCallback);

// 6. Clean up when the component or page is destroyed
km.dispose();

API Reference

constructor(getDataFunc?: GetDataCallback)

Initializes the listener.

  • getDataFunc: (Optional) A sync or async function. The return value of this function is passed as the first argument to every triggered callback.

add(targetKeys: PressableKey[], callback: KeyCallback): void

Registers a callback to a specific combination.

  • targetKeys: An array of PressableKey strings. The order does not matter as the library sorts them internally.
  • callback: The function to run when all keys in the array (and only those keys) are held down.

remove(callback: KeyCallback): void

Unregisters a specific callback function from all key combinations it was assigned to.

dispose(): void

Removes the keydown and keyup listeners from the document and clears all internal maps. Use this during component unmounting or page transitions.


Supported Key Categories

The library utilizes the full W3C UI Events key set. Common categories include:

| Category | Examples | | --- | --- | | Modifiers | Shift, Control, Alt, Meta | | Navigation | ArrowUp, ArrowDown, Home, PageUp | | Editing | Backspace, Delete, Enter, Tab | | UI Control | Escape, ContextMenu, Pause | | Functions | F1 through F20 |


License

MIT © Yousaf Wazir

Building

  • Change version up - push git change
  • Run npm run build
  • Run npm run pubish