input element to turn into a terminal
Optionaloutput: HTMLElementoptional output element to render stdout/stderr to
terminal configuration
history of commands that have been executed
list of commands that can be executed by the user
The input element that the terminal is attached to.
The output manager for the terminal.
The history of commands that have been executed.
The commands that can be executed by the user.
The options for the terminal.
Get the listeners for the terminal.
Get whether the terminal has been initialized.
Emit data to stdout. Dispatches a "stdout" event and logs the data.
the data to emit
Emit data to stderr. Dispatches a "stderr" event and logs the data.
the data to emit
Get a copy of the current stdout log.
the stdout log
Get a copy of the current stderr log.
the stderr log
Get the full terminal prompt.
the full terminal prompt (preprompt + prompt)
Initializes the terminal. Attaches input listeners and updates the input.
Updates the terminal's user input value.
OptionaluserInput: stringthe value to update the input with; clears the input if no value is provided
Gets the terminal's user input.
The string in the input, not including the preprompt and prompt
Gets the command predictions based on the user's input.
Optionaltext: stringThe text to get predictions for; if no text is provided, all commands are returned
The predictions for the terminal's user input
Converts the user's input into an array for command execution.
The string to convert into an array
The array created from the input
Get the last exit object of the terminal.
The last exit object of the terminal; if no exit objects are found, returns undefined
Executes a command based on the user's input.
The command to execute
The ExitObject returned by the execution
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsThe dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Optionaloptions: boolean | EventListenerOptions
Allows you to turn any
HTMLInputElementinto a terminal interface. Define custom commands that can be executed by users, track command history, autocomplete commands, and more.Example