diff --git a/demo/index.html b/demo/index.html index 0d9f6db8..c11b5f02 100644 --- a/demo/index.html +++ b/demo/index.html @@ -9,9 +9,7 @@ - diff --git a/demo/main.js b/demo/main.js index 05adfacf..192c4f15 100644 --- a/demo/main.js +++ b/demo/main.js @@ -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; } diff --git a/src/addons/zmodem/zmodem.js b/src/addons/zmodem/zmodem.js index 95e56460..da99067f 100644 --- a/src/addons/zmodem/zmodem.js +++ b/src/addons/zmodem/zmodem.js @@ -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, {