
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@basementuniverse/input-manager
Advanced tools
A component for handling input events and managing input device state
A component for handling input events and managing input device state.
npm install @basementuniverse/input-manager
Initialise the input manager before use:
import InputManager from '@basementuniverse/input-manager';
InputManager.initialise();
Update the input manager state:
class Game {
// ...
public update(context: CanvasRenderingContext2D) {
InputManager.update();
}
}
Check the state of input devices:
// Check if any key is currently down
InputManager.keyDown();
// Check if a specific key is currently down
InputManager.keyDown(code?);
// Check if a key was pressed
InputManager.keyPressed(code?);
// Check if a key was released
InputManager.keyReleased(code?);
// Check if the main mouse button is currently down
InputManager.mouseDown(button?);
// Check if the main mouse button was pressed
InputManager.mousePressed(button?);
// Check if the main mouse button was released
InputManager.mouseReleased(button?);
// Check if the mouse wheel was scrolled up
InputManager.mouseWheelUp();
// Check if the mouse wheel was scrolled down
InputManager.mouseWheelDown();
// Get the current mouse position in screen-space
const position = InputManager.mousePosition;
See here for a reference of key codes.
const options = { ... };
InputManager.initialise(options);
Option | Type | Default | Description |
---|---|---|---|
element | Window | HTMLElement | window | The element to listen for mouse input events on |
mouse | boolean | true | Enable mouse input |
mouseWheel | boolean | true | Enable mouse wheel input |
keyboard | boolean | true | Enable keyboard input |
preventContextMenu | boolean | false | Try to prevent the context menu from appearing on right-click |
FAQs
A component for handling input events and managing input device state
We found that @basementuniverse/input-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.