Skip to content

juliangruber/key-pressed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

key-pressed

Check if one or more keys are currently pressed.

Usage

var pressed = require('key-pressed')();

// CMD pressed?
pressed([224, 17, 91, 93]);

// Shift pressed?
pressed('shift');

// Shift+CMD pressed?
pressed('shift', [224, 17, 91, 93]);

API

Pressed([el])

Create an instance listening on el or the window object.

pressed(codes)

Check if codes are currently pressed.

All arguments must be pressed, but if an argument is an array, it's enough when one of the codes in that array is pressed.

Supports keyCodes, alt, ctrl, meta and `shift.

pressed.unbind()

Stop listening for events.

Installation

Install with component(1):

$ component install juliangruber/key-pressed

License

MIT

About

Check if one or more keys are currently pressed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages