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

@quickey/core

v1.2.1

Published

Quickey creates keyboard shortcuts for your web apps

Downloads

85

Readme

@quickey/core

Quickey creates keyboard shortcuts for your web apps

Intro

Quickey is a tool that helps you bind keyboard keys to actions in your web app. You can bind multiple actions to specific elements in your page to help your users navigate your application more efficiently and easily.

Install

Quickey can be installed via npm:

$ npm install --save @quickey/core

Or via yarn:

$ yarn add @quickey/core

Or using the CDN:

<script src="https://unpkg.com/@quickey/core@latest/umd/quickey.core.js"></script>

Or the minified version:

<script src="https://unpkg.com/@quickey/core@latest/umd/quickey.core.min.js"></script>

Usage

import { createQuickey } from "@quickey/core";

// Or when using the UMD module

const createQuickey = Quickey.core.createQuickey;

// First, create a new Quickey instance
const quickey = createQuickey();

// Adding actions to your quickey is simple as
quickey
    .addAction({
        id: "god",
        keys: "I > D > D > Q > D",
        alias: [{ keys: 'Ctrl + G' }],
        callback: (keyBinding, target) => {
            console.log("GOD Mode!");
        }
    });

// Remove action
quickey
    .removeAction("god");

For your convenience, we created this Fiddle, so you can take Quickey for a quick spin.

API

Quickey

Quickey([options])

Type: constructor

options

Type: object

id

Type: string

You can supply an id to the quickey object so you can access it later.

title

Type: string

Describe this object with a title.

actions

Type: Array

A list of actions.

onDestroy()

Type: function

Destroy callback function.

target

Type: EventTarget

The key binder keyboard target.

Note! Although you can create a new Quickey with this constructor, you should avoid this method and use only the createQuickey helper function.

All options are optionals

.addAction([options|[options]])

Add Quickey action or actions.

options

Type: object | Array

id

Type: string - optional

You can supply an id to the key binding so you can remove it later if you want to.

keys

Type: string

The combination of keys to bind to.
For Combination binding (hold them together to activate) create a list of keys separated with the + sign. For example:
Ctrl + H, Ctrl + Alt + Delete, Shift + R

For Stream binding (enter one after another to activate) create a list of keys separated with the > sign. For example:
I > D > D > Q > D, Ctrl > Ctrl, H > E > L > L > O

For Single binding (enter one key) supply the key you want to bind to. For example:
J, F, K

See this list for uniqe key options.

alias

Type: Array - optional

You can supply a list of options to the alias option to create aliases with this action.

delay

Type: number - optional

The delay between key strokes when using Stream bindings.

strict

Type: boolean - optional

In Combination bindings, strict mode will activate only if the binded keys are the only active keys in the keyboard.
In Stream bindings, each key must be released before the next one is active.

description

Type: string - optional

Describe the action.

callback([keyBinding,target])

Type: function

A callback to trigger when the action key combination is detected.

.removeAction([id])

Remove a specific action.

id

Type: string

.removeAllActions()

Removes all actions at once.

.enable()

Enables the underlying key binder.

.disable()

Disables the underlying key binder.

.destroy()

Destroy the Quickey object.

.id

Type: string

Get the id of the current instance.

.title

Type: string

Get the title of the current instance.

.disabled

Type: boolean

Get the disabled state of the current instance.

.actions

Type: Array

Get the list of actions of the current instance.


createQuickey([options|[options]])

Type: function

Creates new Quickey or Quickeys

Returns: object | Array

options

Type: object | Array

See .addAction([options|[options]]) options.


getQuickeyInstance([id|[id]])

Type: function

Returns: object | Array

id

Type: string | Array

Quickey id or ids.


← Go back to Quickey