
KeyboardMaster is a tiny, easy, and dependency-free JavaScript library that allows you to bind keyboard shortcuts to any DOM elements.
How to use it:
1. Download the package and import the main JavaScript into the HTML document.
<script src="./lib/index.js"></script>
2. Bind keyboard shortcuts to your element.
document.body.addKeyboardEvents({
keyBindings: {
seperator: ' + ',
bindings: [
{
keyBinding: 'CTRL + ALT + A',
action: () => {
// do something
}
},
// more shortcuts here
]
}
})3. Use the library to enable a cheat code (e.g. Konami code) on your webpage.
document.body.addKeyboardEvents({
passwordBindings: {
timeout: -1,
seperator: '-',
bindings: [
{
passwordBinding: 'c-s-s-s-c-r-i-p-t',
action: () => {
// do something
}
}
]
}
})Changelog:
11/01/2020
- Some bugs fixed
10/20/2020
- Minor changes







