1.0.0 • Published 6 years ago

vm.shortcut v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

VM.registerShortcut

NPM License

Register a shortcut for a function.

This is a helper script for Violentmonkey.

Usage

  1. Use in a userscript:

    // ...
    // @require https://unpkg.com/vm.shortcut
    // ...
    
    VM.registerShortcut('c-i', () => {
      console.log('You have pressed Ctrl-I');
    });
  2. 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

1.0.0

6 years ago

0.1.2

6 years ago

0.1.1

7 years ago

0.1.0

7 years ago