bind-keyboard
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

bind-keyboard

npm npm downloads npm

GitLab (self-managed)

bind-keyboard is a lightweight Typescript library for managing keyboard event bindings and executing callback functions for specific key combinations. It's designed to simplify handling keyboard events in your web applications.

Features

  • Easily bind callback functions to specific key combinations.
  • Supports preventing repeated key press events when holding down a key.
  • Prevents intercepting key events when typing in input fields.
  • Debugging options for different levels of output.

Installation

You can install the "bind-keyboard" library via npm:

npm install bind-keyboard

Usage

To use "bind-keyboard," you need to create an instance of the BindKeyboard class. This instance can be used to add and manage keyboard event bindings. Here's a basic example:

import { BindKeyboard } from "bind-keyboard";

// Create a BindKeyboard instance
const bindKeyboard = new BindKeyboard();

// Add a key binding for ctrl+a
bindKeyboard.add("ctrl+a", (event) => {
  console.log("ctrl+a was pressed");
});

Examples

For more usage examples, please refer to the examples directory in the repository.

License

This project is licensed under the MIT License.

Dependencies (0)

    Dev Dependencies (22)

    Package Sidebar

    Install

    npm i bind-keyboard

    Weekly Downloads

    2

    Version

    0.0.11

    License

    MIT

    Unpacked Size

    234 kB

    Total Files

    15

    Last publish

    Collaborators

    • vladislav-pavlikov