Create Custom Keyboard Shortcuts With The easyShortcut.js Library

Category: Javascript | November 12, 2021
Author:wwwAlireza
Views Total:48 views
Official Page:Go to website
Last Update:November 12, 2021
License:MIT

Preview:

Create Custom Keyboard Shortcuts With The easyShortcut.js Library

Description:

Just another keyboard shortcut JavaScript library for creating “hotkeys” or “cheat codes” on the page.

How to use it:

1. Import the easyShortcut.min.js library into the document.

<script src="easyShortcut.min.js"></script>

2. Trigger a function when you press A on the page.

new shortcut({
    key: "c",
    fn: () => {
      // do something
    }
})

3. Enable/disable modifier keys. Default: false.

new shortcut({
    ctrl: true,
    alt: true,
    shift: false,
    meta: false,
    key: "c",
    fn: () => {
      // CTRL+ALT+A
    }
})

You Might Be Interested In:


Leave a Reply