tty.js
tty.js copied to clipboard
Howto inject external data in the terminal
Hello,
I was wondering what would be the best solution to inject data in the terminal not typed by the user.
What I mean is the following: I want to have some data (text) "typed" in the terminal in a programatic way. To achieve that is it better to do some javascript and write text in the terminal window (simulate a typing)? Or maybe directly write on the websocket (clientside)? Or something else?
Thanks for any ideas!
:thumbsup: I am also interested in this.
Just simulate keydown events. For example, to send "abcd":
var codes = [5,6,7,8];
for(var i = 0; i<codes.length; i++) {
Terminal.focus.keyDown({keyCode: 60 + codes[i]});
}
If I want to simulate a certain keydown event after the terminal are created. where I should put the code?