But that's up to you - it's fully stylable with CSS.
As well as text the widget can host arbitrary HTML content (see
This is not an ANSI/VT100 terminal emulator!
In addition to the following you'll need to add some CSS to your project. Check out the Default CSS section, below, for a starting point.
npm install echo-chamber
var EchoChamber = require('echo-chamber');
Copy and paste either
build/echo-chamber.min.js into your project.
/* Shim text area for receiving keyboard input *//* Line or other item *//* Text line *//* Line currently receiving input *//* Prompt *//* Cursor */
var konsole = new EchoChamber(el, [opts])
Create a new console rooted in the empty div
Modernizr-like feature-detection object, used to detect support for touch devices via the
touchkey. If this option is omitted touch device support will be disabled.
greeting: initial text to display on the console.
handler: function to be called when user presses enter. Receives parameters
(console, command). See 'Handling User Input', below.
cancel: function to be called if user presses escape whilst console is in processing state. Receives parameters
prompt: string or callback function for generating the prompt. Pass
falseif no prompt is desired. If a callback is specified, in addition to returning a string or false, it may elect to return a
<span>element for direct insertion into the DOM. Default:
tabIndex: the tab index of the console. Default:
Returns the command that the user has entered. Throws an exception if console is not in the input state.
Print a text string to the console.
Append a DOM element to the console.
Clear the input bufer.
Prepare the console for the next line of input by generating a new prompt, updating the cursor and putting the console into input mode. You should call this function from your command handler after command processing is complete and the console is ready to accept further input.
Focus on the console.
Handling User Input
When the user presses enter the user supplied handler function is called and receives the console instance and the command string as parameters. Behind the scenes, the console is now in "processing" mode, meaning that further terminal input will be ignored until processing is complete.
konsole.print() to output text during processing, or
konsole.append() to output a DOM node. Once processing is complete simply call
konsole.newline() to begin the next line of user input. Processing, of course, may be performed asynchronously.
Copyright & License
Released under the ISC license.