Krait.js

An open source key bindings library written in TypeScript.

About

The purpose of this library is to provide a simple and easy to use key binding declaration.

Check Example and Code section for more information on how to use Krait.js.

You can help develop Krait.js on Github.

Example

A
Z
E
R

push a,z,e,r keys to test.

Code

Javascript (main.js)

Instantiate a Keyboard class and creates input listeners.

var keyboard = new Krait.Keyboard();

//addInput parameters : ascii code, callback, scope
keyboard.addInput( 65, action0, null );
keyboard.addInput( 'G', action1, null );
keyboard.setInput( 'G','Z' );
keyboard.addInput( 'E', action2, null );
keyboard.addInput( 'R', action3, null );

function action0(){
  
}

function action1(){

}

function action2(){

}

function action3(){
  
}

Contact me

Feel free to ask me about my work, give me suggestions, or just to say hi.