mirror of
https://github.com/nuintun/command-manager.git
synced 2025-06-08 03:55:33 +08:00
36 lines
561 B
JavaScript
36 lines
561 B
JavaScript
/**
|
|
* Created by nuintun on 2015/11/25.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
module.exports = function (Terminal){
|
|
Terminal.focus = null;
|
|
|
|
Terminal.prototype.focus = function (){
|
|
if (Terminal.focus === this) return;
|
|
|
|
if (Terminal.focus) {
|
|
Terminal.focus.blur();
|
|
}
|
|
|
|
if (this.cursor) {
|
|
this.showCursor();
|
|
}
|
|
|
|
if (this.cursorBlink) {
|
|
this.startBlink();
|
|
}
|
|
|
|
Terminal.focus = this;
|
|
};
|
|
|
|
Terminal.prototype.blur = function (){
|
|
if (Terminal.focus !== this) return;
|
|
|
|
this.hideCursor();
|
|
|
|
Terminal.focus = null;
|
|
};
|
|
};
|