Allow attach.js to work

This commit is contained in:
Felipe Gasper
2017-10-16 16:30:29 +01:00
parent a53ca789ea
commit 355d5970a6
3 changed files with 15 additions and 17 deletions
-2
View File
@@ -9,9 +9,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
<script src="/build/xterm.js" ></script>
<!--
<script src="/build/addons/attach/attach.js" ></script>
-->
<script src="/build/addons/zmodem/zmodemjs/dist/zmodem.js" ></script>
<script src="/build/addons/zmodem/zmodem.js" ></script>
+15 -9
View File
@@ -125,15 +125,23 @@ function createTerminal() {
start_form.style.display = "none";
if (document.getElementById("zmstart_yes").checked) {
let zsession = detection.confirm();
current_zsession = zsession;
try {
term.detach();
let zsession = detection.confirm();
if (zsession.type === "receive") {
_handle_receive_session(zsession);
current_zsession = zsession;
if (zsession.type === "receive") {
_handle_receive_session(zsession);
}
else {
_handle_send_session(zsession);
}
}
else {
_handle_send_session(zsession);
catch(e) { throw e }
finally {
term.attach(socket);
}
}
else {
@@ -270,9 +278,7 @@ function abort_current_session() {
}
function runRealTerminal() {
term.on("data", (d) => {
socket.send(d);
});
term.attach(socket);
term._initialized = true;
}
-6
View File
@@ -19,12 +19,6 @@
addon(window.Terminal);
}
})(function _zmodemAddon(Terminal) {
for (let f of ["attach", "terminadoAttach"]) {
if (Terminal.prototype[f]) {
throw new Error(`The “zmodem” and “${f}” addons are mutually incompatible.`);
}
}
Object.assign(
Terminal.prototype,
{