Replies: 2 comments 1 reply
-
|
So freeze is only to disable the input from user, and If you want to disable if (!term.frozen()) {
term.echo('HELLO!');
} |
Beta Was this translation helpful? Give feedback.
-
|
Option 1 — Guard on your end (recommended) let silenced = false;
function silenceTerminal(term) {
silenced = true;
term.freeze(true);
}
function resumeTerminal(term) {
silenced = false;
term.freeze(false);
}
// In your backend data handler:
socket.on("data", (str) => {
if (!silenced) term.echo(str);
});Option 2 — Wrap echo directly on the instance const originalEcho = term.echo.bind(term);
term.echo = (...args) => {
if (!term.frozen()) originalEcho(...args);
};After The key distinction in the API:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have some dynamic terminals on a page and user can choose to disable/enable the terminal. The terminals are connected to a backend COM port which will send the string to terminal in frontend whenever it receive data.
I have tried:
... but later on when I call:
...the
terminalwill still display this string!!!Is this expected behavior? Or those disable terminal methods is only for disable input prompt??
How do I disable, silence, freeze terminals literally then?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions