npm.io
1.0.0 • Published 4 years ago

arrow-key-controller

Licence
ISC
Version
1.0.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0

Arrow Key Controller

Super simple controller designed for canvas games that only use the arrow keys. While an arrow key is pressed down, it is true;

To use:

import { Controller } from 'arrow-key-controller';

const controller = new Controller();

controller.init(); // adds event listener to document

controller.up; // false
controller.down; // false
controller.right; // false
controller.left; // false