tac.keys manages keyboard events triggered by the browser, and calls the corresponding action on anyone who subscribes to the provided service.
This repo is for distribution on bower
. The source for this module is in the
main TacTeam repo.
Please file issues and pull requests against that repo.
You can install this package with bower
.
bower install tac-keys
Optionally you can add --save prefix to add package to bower.js
bower install tac-keys --save
Then add a <script>
to your index.html
:
<script src="/bower_components/tac-keys/dist/keys.js"></script>
You must add the component identifier to Angular dependencies in order to load module into the application.
angular.module('main-application',[
'...dependencies...',
'module.tac.keys',
'...dependencies...'
])
angular.module('main-application')
.run([
'tac.keys',
function(keys) {
keys.bind_keydown(document);
}
])
angular.module('main-application')
.run([
'tac.keys',
'handler',
function(keys, handler) {
keys.bind_keydown(document);
keys.subscribe(handler);
}
])
When a key is pressed tac.key verify the handler implements the corresponding action and call it.
License is not available yet