mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
git demonstration view done pretty much, whatabitch
This commit is contained in:
parent
3d02036a54
commit
b34422d648
9 changed files with 446 additions and 231 deletions
|
@ -20,18 +20,22 @@ function KeyboardListener(options) {
|
|||
this.events = options.events || _.clone(Backbone.Events);
|
||||
this.aliasMap = options.aliasMap || {};
|
||||
|
||||
this.keydownListener = _.bind(this.keydown, this);
|
||||
if (!options.wait) {
|
||||
this.listen();
|
||||
}
|
||||
}
|
||||
|
||||
KeyboardListener.prototype.listen = function() {
|
||||
Main.getEventBaton().stealBaton('docKeydown', this.keydownListener, this);
|
||||
if (this.listening) {
|
||||
return;
|
||||
}
|
||||
this.listening = true;
|
||||
Main.getEventBaton().stealBaton('docKeydown', this.keydown, this);
|
||||
};
|
||||
|
||||
KeyboardListener.prototype.mute = function() {
|
||||
Main.getEventBaton().releaseBaton('docKeydown', this.keydownListener, this);
|
||||
this.listening = false;
|
||||
Main.getEventBaton().releaseBaton('docKeydown', this.keydown, this);
|
||||
};
|
||||
|
||||
KeyboardListener.prototype.keydown = function(e) {
|
||||
|
@ -42,12 +46,16 @@ KeyboardListener.prototype.keydown = function(e) {
|
|||
return;
|
||||
}
|
||||
|
||||
this.fireEvent(key);
|
||||
this.fireEvent(key, e);
|
||||
};
|
||||
|
||||
KeyboardListener.prototype.fireEvent = function(eventName) {
|
||||
KeyboardListener.prototype.fireEvent = function(eventName, e) {
|
||||
eventName = this.aliasMap[eventName] || eventName;
|
||||
this.events.trigger(eventName);
|
||||
this.events.trigger(eventName, e);
|
||||
};
|
||||
|
||||
KeyboardListener.prototype.passEventBack = function(e) {
|
||||
Main.getEventBaton().passBatonBackSoft('docKeydown', this.keydown, this, [e]);
|
||||
};
|
||||
|
||||
exports.KeyboardListener = KeyboardListener;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue