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 🙏

© 2025 – Pkg Stats / Ryan Hefner

keybee

v0.4.0

Published

Small utility library to simulate a sequence of key press in the browser

Readme

KeyBee 🐝

KeyBee is a small utility library to simulate a sequence of key presses in the browser. Great for testing and debugging Lightning-based Apps that rely on key-press–based navigation.

Installation

KeyBee is published in two flavours so you can choose the one that fits your use case:

ES Module (ESM)

Use the ES module for modern build setups (Vite, Webpack, Rollup, etc.) if you want to include the KeyBee library directly in your App bundle.

First install KeyBee from NPM: npm install keybee

Next import and use $keybee in your codebase, like so:

import $keybee from 'keybee'

$keybee.run([{ key: 'ArrowDown', repeat: 3 }, { key: 'Enter' }])

Additionally, you can also use this ESM version directly in the browser with <script type="module">.

IIFE build (global)

There is also a self-contained bundle that works in a plain <script> tag without any bundler. It attaches $keybee to the window object:

<script src="keybee.iife.min.js"></script>
<script>
  $keybee([{ key: 'ArrowDown', repeat: 3 }, { key: 'Enter' }])
</script>

Bookmarklet

You can also leverage the IIFE build to quickly add the library to an existing and running browser tab via a bookmarklet.

Once added to your bookmarks, clicking the KeyBee bookmark will import the library and make $keybee available on the global window object. After that you can interact with it directly in the web console and simulate key presses in an existing App.

👉 Get the KeyBee Bookmarklet

Usage

KeyBee comes with two exposed methods: $keybee.run and $keybee.defaults.

$keybee.run

This is the main KeyBee method that will run a sequence of key presses. It accepts a sequence array as the first argument and an optional second argument with options.

sequence

The sequence array is an array of objects which define the steps in the sequence.

A step object looks like this:

{
  key: 'ArrowUp', // key to simulate (required)
  repeat: 4,      // number of times to repeat this key (optional, defaults to 1)
  wait: 1000,     // ms of wait time after key presses (optional, defaults to 800ms)
}

Combined, a basic KeyBee sequence to navigate will look something like this:

$keybee.run([
  // navigate through a rail 5 times
  { key: 'ArrowRight', repeat: 5 },
  // navigate back to the start
  { key: 'ArrowLeft', repeat: 5 },
  // navigate to the side menu
  { key: 'ArrowLeft' },
  // move down in the menu
  { key: 'ArrowDown' },
  // open the menu item by pressing Enter
  { key: 'Enter' },
  // navigate through a rail 5 times
  { key: 'ArrowRight', repeat: 5 },
])

options

KeyBee can be configured with a few options. These can be passed to the $keybee.run() method as the second argument.

The options object has the following format:

{
  keyPressDuration: 30, // duration in ms of the key press (time between keydown and keyup, defaults to 30)
  wait: 800,            // default time in ms to wait after a key press (can be overridden per sequence step, defaults to 800)
  loop: 1,              // how many times to loop over the sequence (defaults to 1)
}

$keybee.defaults

Instead of passing the options separately to each $keybee.run invocation, it's also possible to specify default options once using the $keybee.defaults method.

These defaults will then be used in every $keybee.run sequence:

$keybee.defaults({
  keyPressDuration: 30, // duration in ms of the key press (time between keydown and keyup, defaults to 30)
  wait: 800,            // default time in ms to wait after a key press (can be overridden per sequence step, defaults to 800)
  loop: 1,              // how many times to loop over the sequence (defaults to 1)
})