Show More
@@ -1,41 +1,41 | |||
|
1 | 1 | define ([], function() { |
|
2 | 2 | "use strict"; |
|
3 | 3 | function make_terminal(element, size, ws_url) { |
|
4 | 4 | var ws = new WebSocket(ws_url); |
|
5 | 5 | Terminal.brokenBold = true; |
|
6 | 6 | var term = new Terminal({ |
|
7 | 7 | cols: size.cols, |
|
8 | 8 | rows: size.rows, |
|
9 |
screenKeys: |
|
|
9 | screenKeys: false, | |
|
10 | 10 | useStyle: false |
|
11 | 11 | }); |
|
12 | 12 | ws.onopen = function(event) { |
|
13 | 13 | ws.send(JSON.stringify(["set_size", size.rows, size.cols, |
|
14 | 14 | window.innerHeight, window.innerWidth])); |
|
15 | 15 | term.on('data', function(data) { |
|
16 | 16 | ws.send(JSON.stringify(['stdin', data])); |
|
17 | 17 | }); |
|
18 | 18 | |
|
19 | 19 | term.on('title', function(title) { |
|
20 | 20 | document.title = title; |
|
21 | 21 | }); |
|
22 | 22 | |
|
23 | 23 | term.open(element); |
|
24 | 24 | |
|
25 | 25 | ws.onmessage = function(event) { |
|
26 | 26 | var json_msg = JSON.parse(event.data); |
|
27 | 27 | switch(json_msg[0]) { |
|
28 | 28 | case "stdout": |
|
29 | 29 | term.write(json_msg[1]); |
|
30 | 30 | break; |
|
31 | 31 | case "disconnect": |
|
32 | 32 | term.write("\r\n\r\n[CLOSED]\r\n"); |
|
33 | 33 | break; |
|
34 | 34 | } |
|
35 | 35 | }; |
|
36 | 36 | }; |
|
37 | 37 | return {socket: ws, term: term}; |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | return {make_terminal: make_terminal}; |
|
41 | 41 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now