Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidarchanjo/keydown-event-dispatcher
Utility module for dispatching keydown events in web applications.
https://github.com/davidarchanjo/keydown-event-dispatcher
Last synced: 6 days ago
JSON representation
Utility module for dispatching keydown events in web applications.
- Host: GitHub
- URL: https://github.com/davidarchanjo/keydown-event-dispatcher
- Owner: davidarchanjo
- Created: 2024-06-03T23:28:34.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-04T15:16:15.000Z (5 months ago)
- Last Synced: 2024-10-05T17:04:24.207Z (about 1 month ago)
- Language: TypeScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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`
```bash
npm install keydown-event-dispatcher
```
- `pnpm`
```bash
pnpm install keydown-event-dispatcher
```
- `yarn`
```bash
yarn add keydown-event-dispatcher
```## Usage
- In projects using the CommonJS module system
```javascript
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
```typescript
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](https://opensource.org/license/isc-license-txt).