1.3.26 • Published 4 years ago
td-set-shortcuts v1.3.26
A javascript package to set shortcuts, and callbacks.
- Supports nested key order.
- Supports focus mode.
installation
Install the npm package:
npm i td-set-shortcuts
And:
window.setShortcut = require('td-set-shortcuts');
Usage
// Set shortcuts
let shortcuts = {
'ControlLeft': {
'KeyH': () => {
console.log("Hello World!");
},
'*': (e) => {
if(e.key !== 'h') console.log("You pressed [control + other keys]!");
},
}
};
// Set the block in which commands should be executed (default: document).
let block = document;
// Set if the block is focused by default or not. (default: true).
let is_focused = true;
// Set if preventDefault should be executed (default: true)
let prevent_default = true;
// Run the package.
setShortcut(shortcuts, block, is_focused, prevent_default);
Note: Do not use alert in callback functions. When alert is executed, the keyup won't get fired, and the library won't work correctly.
1.2.25
4 years ago
1.2.26
4 years ago
1.3.26
4 years ago
1.2.18
4 years ago
1.2.19
4 years ago
1.2.20
4 years ago
1.2.23
4 years ago
1.2.24
4 years ago
1.2.21
4 years ago
1.1.17
4 years ago
1.1.9
4 years ago
1.1.8
4 years ago
1.1.7
4 years ago
1.1.12
4 years ago
1.1.11
4 years ago
1.1.10
4 years ago
1.1.16
4 years ago
1.1.15
4 years ago
1.1.14
4 years ago
1.1.13
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago