Author: | medihack |
---|---|
Views Total: | 323 views |
Official Page: | Go to website |
Last Update: | July 16, 2018 |
License: | MIT |
Preview:

Description:
keycuts is an ES6 JavaScript library which allows you to bind custom keyboard shortcut events and trigger custom specified functions when the key combinations are pressed
How to use it:
Download & Install the keycuts package with package managers.
# Yarn $ yarn add keycuts # NPM $ npm install keycuts --save
Import the keycuts as an ES6 module.
import { Keys } from 'keycuts'
Or include the compiled version of the keycuts library on the page.
<script src="keycuts.min.js"></script>
Create a new keyboard shortcut object.
const myKeys = new Keys();
Define your own keyboard shortcuts & callback functions as these:
keys.bind(['Control', 'c'], () => { // do something }) // or keys.bind(['Control + c'], () => { // do something })
The library also supports sequences of key or key combinations.
myKeys.bind([['Control', 'c'], ['Alt', 'v']], () => { // do something }) // or myKeys.bind('Control + c > Control + v', () => { // do something })