arrow-key-controller

A key event listener for arrow keys built in typescript

Usage no npm install needed!

<script type="module">
  import arrowKeyController from 'https://cdn.skypack.dev/arrow-key-controller';
</script>

README

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