Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

yields/k-sequence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k-sequence

keyboard sequences.

Installation

Install with component(1):

$ component install yields/k-sequence

API

seq(keys[, ms], fn)

Create a function that will be invoked only if the given keys sequence is matched, ms can be omitted and defaulted to 500ms.

if ms is 500ms the keys must be pressed within 500ms for the callback to be called.

var a = seq('a b c', function(e){});
var b = seq('a * b * c', function(e){});
el.addEventListener('keydown', a);
el.addEventListener('keydown', b);

press('a b c'); // => a is called
press('a a b b c'); // => b is called

Tests

$ make test

License

MIT

About

keyboard sequences

Resources

Stars

Watchers

Forks

Packages

No packages published