Skip to content

Easily add combination key-press event listeners in JavaScript.

License

Notifications You must be signed in to change notification settings

xaneem/js-shortcuts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-shortcuts

Easily add combination key-press event listeners in JavaScript. Useful for adding keyboard shortcuts to web applications.

Here's the original version. I'm putting this up on GitHub to make loading this using Bower a bit easier.

Usage

Basic Version

shortcut.add("Ctrl+B", function () {
  window.alert("Make it Bold!");
});

AngularJS

app.controller('yourCtrl', function(jsShortcuts) {

  jsShortcuts.add("Ctrl+B", function () {
    window.alert("Make it Bold!");
  });  
  
});

More information available on the original doc page.

Installation

Bower

Install via bower:

bower install js-shortcuts --save 

and require the script:

<script src="bower_components/js-shortcuts/js-shortcuts.js"></script>

Angular

Install via bower as above. Use the AngularJS version of the script.

<script src="bower_components/js-shortcuts/js-shortcuts-angular.js"></script>

Add the module js-shortcuts as a dependency to your app

var app = angular.module('yourAwesomeApp', ['js-shortcuts']);

License

BSD License

About

Easily add combination key-press event listeners in JavaScript.

Resources

License

Stars

Watchers

Forks

Packages