Author: | akaizn-junior |
---|---|
Views Total: | 92 views |
Official Page: | Go to website |
Last Update: | April 3, 2019 |
License: | MIT |
Preview:

Description:
keylani.js is a small JavaScript library to bind and map keyboard shortcuts and key presses in a simple way.
How to use it:
Download and import the keylani.js library from the dist
folder.
<script src="/dist/umd/keylani.min.js"></script>
Show keyboard shortcuts on an element (OPTIONAL).
<button data-keybind="t+1" data-keyshow="true">T & 1</button>
Bind keyboard shortcuts and execute callbacks when the keys are pressed.
Keylani.bind('Control + c', (pressed) => { // do something });
Bind an object of keyboard shortcuts.
Keylani.map({ 'a': (pressed) => { // do something }, 'Ctrl + a': (pressed) => { // do something }, ... });
Run all keyboard bindings when you click a trigger element.
Keylani .when('click', document.getElementById('clickhere')) .run({ // do something });