@hydroper/inputaction@1.0.6
latest
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers




JSR Score
52%
Published
9 months ago (1.0.6)
Input action
Input action library for web applications.
This library allows managing and handling keyboard actions such as shortcuts. It may support gamepads in the future.
Features:
- Reflect actions
- Shortcut display text
- Pooling of pressed keys
Getting started
import { Input } from "@hydroper/inputaction"; Input.input.setActions({ "moveLeft": [ { key: "a" }, { key: "leftArrow" }, ], "moveRight": [ { key: "d" }, { key: "rightArrow" }, ], "moveUp": [ { key: "w" }, { key: "upArrow" }, ], "moveDown": [ { key: "s" }, { key: "downArrow" }, ], }); Input.input.addEventListener("inputPressed", () => { // use isPressed() or justPressed() const shouldMoveRight = Input.input.justPressed("moveRight"); });
Add Package
deno add jsr:@hydroper/inputaction
Import symbol
import * as inputaction from "@hydroper/inputaction";
Import directly with a jsr specifier
import * as inputaction from "jsr:@hydroper/inputaction";
Add Package
pnpm i jsr:@hydroper/inputaction
pnpm dlx jsr add @hydroper/inputaction
Import symbol
import * as inputaction from "@hydroper/inputaction";
Add Package
yarn add jsr:@hydroper/inputaction
yarn dlx jsr add @hydroper/inputaction
Import symbol
import * as inputaction from "@hydroper/inputaction";
Add Package
vlt install jsr:@hydroper/inputaction
Import symbol
import * as inputaction from "@hydroper/inputaction";
Add Package
npx jsr add @hydroper/inputaction
Import symbol
import * as inputaction from "@hydroper/inputaction";
Add Package
bunx jsr add @hydroper/inputaction
Import symbol
import * as inputaction from "@hydroper/inputaction";