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-shortcutsAnd:
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
5 years ago
1.2.19
5 years ago
1.2.20
5 years ago
1.2.23
5 years ago
1.2.24
5 years ago
1.2.21
5 years ago
1.1.17
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.12
5 years ago
1.1.11
5 years ago
1.1.10
5 years ago
1.1.16
5 years ago
1.1.15
5 years ago
1.1.14
5 years ago
1.1.13
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago