KeySequence 0.2

Create custom events for sequences of key presses.



Details

Author
Ben Lenarts
Current version
0.2
GitHub
benlenarts/KeySequence
Downloads
3870
Category
Interface
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_: core/1.2.4: Element.Event

How to use

Create a custom event by calling addKeySequence with an event name and an array of key names:

Element.Events.addKeySequence('konamicode', 'up up down down left right left right b a'.split(' ')); 

Now you can attach handlers to this new event:

document.addEvent('konamicode', function() { alert('KONAMI'); });

For more examples please check out the demo!


Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus