Fixed unbinding keyboard shortcuts
This commit is contained in:
parent
dd1dfcb9e8
commit
9c29f6173d
1 changed files with 3 additions and 0 deletions
|
@ -3,10 +3,12 @@ var App = App || {};
|
||||||
App.Keyboard = function(mousetrap) {
|
App.Keyboard = function(mousetrap) {
|
||||||
|
|
||||||
function keyup(key, callback) {
|
function keyup(key, callback) {
|
||||||
|
unbind(key);
|
||||||
mousetrap.bind(key, simpleKeyPressed(callback), 'keyup');
|
mousetrap.bind(key, simpleKeyPressed(callback), 'keyup');
|
||||||
}
|
}
|
||||||
|
|
||||||
function keydown(key, callback) {
|
function keydown(key, callback) {
|
||||||
|
unbind(key);
|
||||||
mousetrap.bind(key, simpleKeyPressed(callback));
|
mousetrap.bind(key, simpleKeyPressed(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +25,7 @@ App.Keyboard = function(mousetrap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function unbind(key) {
|
function unbind(key) {
|
||||||
|
mousetrap.unbind(key, 'keyup');
|
||||||
mousetrap.unbind(key);
|
mousetrap.unbind(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue