Skip to content

ioslh/keyshortcut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Shortcut Library For Web App

Config

KeyShortcut.config({
    // whether show key input info in console
    DEBUG: true,
    // max delay time to press next key for a combination
    timeout: 300
});

Register Your Shortcuts

Define the key shortcut join with +, such as 'shift+a', 'a+b', etc.

KeyShortcut.register('g',function( key ){
    console.log("I just triggered key: " + key );
},document.querySelector('#input'));

OR

KeyShortcut.register({
    'g+k':function( key ){
        console.log("I just triggered key: " + key );
    },
    'g+a':function( key ){
        console.log("I just triggered key: " + key );
    },
    'meta+c':function( key ){
        console.log("I just triggered key: " + key );
    },
    'a+b+c':function( key ){
        console.log("I just triggered key: " + key );
    },
    'c':function( key ){
        console.log("I just triggered key: " + key );
    }
});

About

A Shortcut Library For Web App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published