bugfix
This commit is contained in:
parent
a645b11f59
commit
faca3f338d
@ -10,6 +10,7 @@ bricks.Wterm = class extends bricks.JsWidget {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
this.socket = null;
|
||||||
schedule_once(this.open.bind(this), 0.5);
|
schedule_once(this.open.bind(this), 0.5);
|
||||||
}
|
}
|
||||||
charsize_sizing(){
|
charsize_sizing(){
|
||||||
@ -22,6 +23,8 @@ bricks.Wterm = class extends bricks.JsWidget {
|
|||||||
this.term = term;
|
this.term = term;
|
||||||
term.open(this.dom_element);
|
term.open(this.dom_element);
|
||||||
var ws = new WebSocket(this.opts.ws_url);
|
var ws = new WebSocket(this.opts.ws_url);
|
||||||
|
this.socket = ws;
|
||||||
|
|
||||||
this.fitAddon = new FitAddon.FitAddon()
|
this.fitAddon = new FitAddon.FitAddon()
|
||||||
term.loadAddon(this.fitAddon)
|
term.loadAddon(this.fitAddon)
|
||||||
this.fitAddon.fit();
|
this.fitAddon.fit();
|
||||||
@ -30,6 +33,9 @@ bricks.Wterm = class extends bricks.JsWidget {
|
|||||||
ws.onmessage = msg => {
|
ws.onmessage = msg => {
|
||||||
term.write(JSON.parse(msg.data).data);
|
term.write(JSON.parse(msg.data).data);
|
||||||
};
|
};
|
||||||
|
ws.onclose = (event) => {
|
||||||
|
console.log('websocket closed:', event.code, '--', event.reason);
|
||||||
|
}
|
||||||
ws.onopen = function(){
|
ws.onopen = function(){
|
||||||
term.paste('ls -l\n')
|
term.paste('ls -l\n')
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user