vm.shortcut
v1.0.0
Published
Register a shortcut for a function
Downloads
16
Readme
VM.registerShortcut
Register a shortcut for a function.
This is a helper script for Violentmonkey.
Usage
Use in a userscript:
// ... // @require https://unpkg.com/vm.shortcut // ... VM.registerShortcut('c-i', () => { console.log('You have pressed Ctrl-I'); });
Use as a module:
$ yarn add vm.shortcut
import VM from 'vm.shortcut'; VM.registerShortcut('c-i', () => { console.log('You have pressed Ctrl-I'); });
API
VM.registerShortcut(shortcut, callback)
Parameters:
shortcut: string
Dash connected key combinations, modifiers first. Here are some good examples:
# Ctrl + I c-i Ctrl-I ctrl-i # Ctrl + Shift + A c-s-a Ctrl-Shift-A ctrl-shift-a Shift-Ctrl-A
callback: function