Lightweight Key Binding & Mapping Library – keylani.js

Category: Javascript | April 3, 2019
Views Total:111 views
Official Page:Go to website
Last Update:April 3, 2019


Lightweight Key Binding & Mapping Library – keylani.js


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.{
  'a': (pressed) => { // do something },
  'Ctrl + a': (pressed) => { // do something },

Run all keyboard bindings when you click a trigger element.

  .when('click', document.getElementById('clickhere'))
    // do something

You Might Be Interested In:

Leave a Reply