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

hi-shortcut

v1.0.2

Published

The ShortCut class is designed to simplify the process of creating keyboard shortcuts in web applications. It allows you to define custom key combinations and associate actions with them.

Downloads

4

Readme

hi-shortcut

The ShortCut class is designed to simplify the process of creating keyboard shortcuts in web applications. It allows you to define custom key combinations and associate actions with them.

Install

npm install hi-shortcut

Class Methods:

listen(shortcut_name, key, callback):
    Adds a listener for a single key combination.
    Triggers the specified action when the combination is detected.

listenMulti(shortcut_name, key, callback):
    Adds a listener for multiple key combinations.
    Triggers the specified action when the full combination is detected.

remove(shortcut_name):
    Removes a specific listener.

Example Usage:

// import
import {ShortCut} from 'hi-shortcut'

const shortcut = new ShortCut('alt')

shortcut.listn('new_user', 'n',()=>{
  // alt + n
})

shortcut.listn('remove_user', 'r',()=>{
  // alt + r
})

In the above example, the event is triggered when the user presses the alt and n or alt and r keys at the same time. But you can also use multiple key combinations like the code below.

shortcut.listnMulti('save_info', ['a', 'h', 'j'] ,()=>{
  // alt a + h + j
})

The above event is executed when the alt, a, h, and j keys are pressed simultaneously.

Sometimes we may want to consider multiple key combinations for an event. For example, we want the same operation to be performed when the user presses the alt and a key or presses the alt and b keys (multiple similar shortcuts).

shortcut.listn('new_user', ['a','b','ش'],()=>{
  // alt + a or alt + b or alt + ش
})

shortcut.listnMulti('remove_user', [ ['a','ش'], ['b', 'ذ']] ,()=>{
  // alt + (a or ش) + (b or ذ)
})

The above event is triggered when the alt key is pressed with a or alt with b or alt with ش. This feature is especially useful for users who use multiple keyboards, who can customize their events for other keyboards and languages.

To remove and disable a shortcut, you can use the remove method:


shortcut.remove('shortcut_name')