Input handling in Jaws

Pure JavaScript input handling can be cumbersome juggling key/char Codes.
Jaws makes it easier, providing string-identifiers for each key.
More compact code and a lot easier to read.

Manual check of keys

Anywhere in your code, you can instantly check of a key is pressed down:
jaws.pressed("left");  // returns true if arrow key is pressed
jaws.pressed("a");     // returns true if key "a" is pressed
 Often this is to prefer over classical input-events for simpler games since you can have all your "move"-logic in one place.

Evented

Jaws also supports classic evented keyboardinputs like this: // call goLeft() when left arrow key is  pressed
jaws.on_keypress("left", goLeft) 

// call fireWeapon() when SPACE or CTRL is pressed
jaws.on_keypress(["space","ctrl"], fireWeapon)

Available keyshortcuts

"backspace" "tab" "enter" "shift" "ctrl" "alt" "pause" "capslock" "esc" "space" "pageup" "pagedown" "end" "home" "left" "up" "right" "down" "insert" "delete" "leftwindowkey" "rightwindowkey" "selectkey" "multiply" "add" "subtract" "decimalpoint" "divide" "numlock" "scrollock" "semicolon" "equalsign" "comma" "dash" "period" "forwardslash" "graveaccent" "openbracket" "backslash" "closebracket" "singlequote" "numpad1","numpad2","numpad3","numpad4","numpad5","numpad6","numpad7","numpad8","numpad9" "f1","f2","f3","f4","f5","f6","f7","f8","f9" "0","1","2","3","4","5","6","7","8","9" "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"