Reputation: 3074
how may i log stuff into the terminal before the user focuses the terminal and presses enter key?
I cannot find a way to access the echo method of the terminal outside a call function scope.
The "greetings" option is good but it does not help, i am trying to use the terminal to show the logs of a background application that is constantly running.
Thank you.
Upvotes: 0
Views: 721
Reputation: 3074
Found it, by setting the "terminal" method to a variable it actually returns the created terminal (as a constructor).
Took me a while to find out, maybe because i don't have much experience with JScript and it has some different concepts about variable access, inheritance, etc.. than other languages.
Now i can store the created terminal and use it right after creation:
$(function () {
var terminal;
terminal = $('#consolediv').terminal(function(command, term) {
if (command !== '') {
interp.eval(command);
} else {
term.echo('');
}
}, { greetings: false });
terminal.echo("logging and using terminal right after creation");
});
Upvotes: 1