-
Notifications
You must be signed in to change notification settings - Fork 199
/
terminal-linux.js
38 lines (30 loc) · 1.08 KB
/
terminal-linux.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var Terminal = require("../master/dev/terminal");
function LinuxTerm(termElementId) {
this.termElementId = termElementId;
}
LinuxTerm.prototype.Init = function(jor1kGUI, tty) {
this.term = new Terminal(24, 80, this.termElementId);
jor1kGUI.message.Register(tty, function(d) {
d.forEach(function(c) {
this.term.PutChar(c&0xFF);
}.bind(this));
}.bind(this));
this.terminalcanvas = document.getElementById(this.termElementId);
this.terminalcanvas.onmousedown = function(event) {
if (!jor1kGUI.framebuffer) return;
jor1kGUI.framebuffer.fbcanvas.style.border = "2px solid #000000";
}.bind(this);
}
LinuxTerm.prototype.WasHitByEvent = function(evt) {
return this.terminalcanvas.contains(evt.target);
}
LinuxTerm.prototype.PauseBlink = function(pause) {
this.term.PauseBlink(pause);
}
LinuxTerm.prototype.SetCharReceiveListener = function (callback) {
this.term.OnCharReceived = callback;
}
LinuxTerm.prototype.RemoveCharReceiveListener = function () {
this.term.OnCharReceived = function (){};
}
module.exports = LinuxTerm;