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 🙏

© 2024 – Pkg Stats / Ryan Hefner

v_shortkeys

v0.0.8

Published

Simple Shortcut Handler with auto[re]triggering time, cooldown time, and more.

Downloads

3

Readme

🎹 v_shortkeys

Simple way to have Keyboard Shortcuts with auto-triggering, cooldown times, and more.

ALPHA VERSION : NOT READY FOR USE !

🚀 1st Install

npm i v_shortkeys --save

🔧 2nd Basic Usage

const vShortKeys = require('v_shortkeys');
var vsk = new vShortKeys();

vsk.registerShortcut("number1", [49], () => console.log('YEA Demo Button 1')); //-> Registers new keyCombo
vsk.disableShortcut("number1"); //-> Sets disabled status to TRUE
vsk.enableShortcut("number1");  //-> ReEnables it by setting it now to FALSE
vsk.unregisterShortcut("number1");  //-> Unregister that shortcut, remove this to keep it working.

This will execute passed function when user presses key 49 which is actually "Number 1" key.

NOTE: Number 1 on the numeric keyboard is not the same button!


📐 Additional Options:

👉 Register New Shortcut/Key-Combo

  • Will register a new shortcut/key-combo

    vsk.registerShortcut(name, buttons, callback, description, autoTrigger, coolDown);

ARGS:

  • name : String
  • buttons : Array of numbers/Keys
  • callback : Function
  • description : String
  • autoTrigger : Number / ms to wait before re-triggering
  • coolDown : Number / ms to wait before being able to trigger it again

🔻 Unregister Shortcut

  • Will Remove shortcut/key-combo from the list. Uses name to find it

    vsk.unregisterShortcut( name );

🚫 Disable Item

  • Will Disable a shortcut/key-combo by Name as String.

     vsk.disableShortcut( name );

🟢 Enable Item

  • Will Enable a shortcut/key-combo by Name as String.

    vsk.enableShortcut( name );

🌀 Change Loop Interval

  • Set the loop interval time in milliseconds as number.

    // Default: (1000 ms / 60) => 60hz
    vsk.setOption({ interval : (1000 ms / 60) });

🌀 Enable/Disable Debug Logging

  • Enable logging to console for debug.

    vsk.setOption({ debug : true });

👷‍♂️ Extended Example Use

const vShortKeys = require('v_shortkeys');
var vsk = new vShortKeys();

//* Enable Debugging and Extend Interval to super long time. Less looping.
vsk.setOption({ debug: true, interval: 250 });

//* vShortKeys.registerShortcut(name, buttons, callback, description, autoTrigger, coolDown)
vsk.registerShortcut("clearConsole", [67, 83], clearConsole, "[c + s] \n Will clear the console messages.", 500, 1000);
vsk.registerShortcut("rootModal", [77, 79, 68], toggleRootModal, "[m + o + d] \n Random demo modal pops up.", 2000, 1000);
vsk.registerShortcut("fullScreen.toggle", [18, 13], fullScreen.toggle, "[alt + enter] \n Toggler for the fullscreen mode.", 1000, 0);
vsk.registerShortcut("console.log", [81, 87, 69], messageConsoleDemo, "[q + w + e] \n This will send console log message.", 250, 1000);

vsk.unregisterShortcut("clearConsole");
vsk.disableShortcut("rootModal");

// Check the ./EXAMPLE/source/appExample.js for more ways to configure and init

Additional Screenshot From The Example: Example Running these from the Folder ./EXAMPLE/


📑 Related links :