mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 07:08:08 +00:00
Fix race condition
This commit is contained in:
2
butterfly/static/ext.min.js
vendored
2
butterfly/static/ext.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -13,6 +13,7 @@
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var ctl, lastData, queue, send, t_queue, term, treat, ws, wsUrl;
|
||||
term = null;
|
||||
send = function(data) {
|
||||
return ws.send('S' + data);
|
||||
};
|
||||
@@ -35,6 +36,9 @@
|
||||
ws = new WebSocket(wsUrl);
|
||||
ws.addEventListener('open', function() {
|
||||
console.log("WebSocket open", arguments);
|
||||
term = new Terminal(document.body, send, ctl);
|
||||
term.ws = ws;
|
||||
window.butterfly = term;
|
||||
ws.send('R' + term.cols + ',' + term.rows);
|
||||
return openTs = (new Date()).getTime();
|
||||
});
|
||||
@@ -78,14 +82,11 @@
|
||||
return open('', '_self').close();
|
||||
}
|
||||
});
|
||||
term = new Terminal(document.body, send, ctl);
|
||||
addEventListener('beforeunload', function() {
|
||||
if (!quit) {
|
||||
return 'This will exit the terminal session';
|
||||
}
|
||||
});
|
||||
term.ws = ws;
|
||||
window.butterfly = term;
|
||||
window.bench = function(n) {
|
||||
var rnd;
|
||||
if (n == null) {
|
||||
|
||||
4
butterfly/static/main.min.js
vendored
4
butterfly/static/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -22,7 +22,7 @@ openTs = (new Date()).getTime()
|
||||
$ = document.querySelectorAll.bind(document)
|
||||
|
||||
document.addEventListener 'DOMContentLoaded', ->
|
||||
|
||||
term = null
|
||||
send = (data) ->
|
||||
ws.send 'S' + data
|
||||
|
||||
@@ -43,6 +43,9 @@ document.addEventListener 'DOMContentLoaded', ->
|
||||
|
||||
ws.addEventListener 'open', ->
|
||||
console.log "WebSocket open", arguments
|
||||
term = new Terminal document.body, send, ctl
|
||||
term.ws = ws
|
||||
window.butterfly = term
|
||||
ws.send 'R' + term.cols + ',' + term.rows
|
||||
openTs = (new Date()).getTime()
|
||||
|
||||
@@ -84,14 +87,10 @@ document.addEventListener 'DOMContentLoaded', ->
|
||||
if (new Date()).getTime() - openTs > 60 * 1000
|
||||
open('','_self').close()
|
||||
|
||||
term = new Terminal document.body, send, ctl
|
||||
addEventListener 'beforeunload', ->
|
||||
if not quit
|
||||
'This will exit the terminal session'
|
||||
|
||||
term.ws = ws
|
||||
window.butterfly = term
|
||||
|
||||
|
||||
window.bench = (n=100000000) ->
|
||||
rnd = ''
|
||||
|
||||
Reference in New Issue
Block a user