1.0.2 • Published 1 year ago

keydown-event-dispatcher v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Keydown Event Dispatcher

A utility module for dispatching keydown events in web applications. Provides predefined key codes and a function to simulate keydown events programmatically. Compatible with JavaScript and TypeScript projects.

Installation

You can install the Keydown Event Dispatcher module via:

  • npm
npm install keydown-event-dispatcher
  • pnpm
pnpm install keydown-event-dispatcher
  • yarn
yarn add keydown-event-dispatcher

Usage

  • In projects using the CommonJS module system
const { triggerKeyboardEvent, KeyCodes } = require('keydown-event-dispatcher');

// Trigger an Enter key event on the document
triggerKeyboardEvent(document.body, KeyCodes.Enter);
  • In projects using the ES6 module system
import { triggerKeyboardEvent, KeyCodes } from 'keydown-event-dispatcher';

// Trigger an Enter key event on the document
triggerKeyboardEvent(document.body, KeyCodes.Enter);

Key Codes

The module provides predefined key codes for common keyboard keys. Here are some examples:

  • KeyCodes.Enter: Enter key
  • KeyCodes.ArrowUp: Arrow Up key
  • KeyCodes.ArrowDown: Arrow Down key
  • ...

For the full list of key codes, please refer to the source code.

Contributing

Contributions are welcome! If you find a bug or want to suggest a feature, please open an issue on GitHub or submit a pull request.

License

This project is licensed under the ISC License.

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago