Skip to content

jimo1001/js-lib-keybinds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

the script is a simple JavaScript library for keyboard shortcut.
the keybinds is a factory class of Keybind[s](shortcutkey[s])

Usage:
- add Keybind(Control+y)
  keybinds.add(element, 'C-y', function (event, [object Keybind]) { ... }, false)
                .add(element, 'C-x', function (event, [object Keybind]) { ... }, false);
- remove Keybind
  keybinds.remove([object Keybind]);
  or
  keybinds.removeByKey('C-y');
  or
  keybinds.removeByKey('C-y', element);
- get key
  var textform = document.getElementById('text-form');
  keybinds.getKey(textform, function(key, event) { ... });
- get Keybinds
  - all keybinds
    var keybinds = keybinds.getKeybinds();
  - by key
    var keybinds = keybinds.getKeybinds('C-y');
  - by element
    var keybinds = keybinds.getKeybinds(window);
  - by key and element
    var keybinds = keybinds.getKeybinds('C-y', window);

About

JavaScript Libraries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published