npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

echo-chamber

v0.3.2

Published

"terminal" widget built with HTML/CSS/JS

Downloads

42

Readme

echo-chamber

echo-chamber is a simple, no-frills console component built with HTML, CSS and Javascript. It might look a bit like this:

Echo Chamber Screenshot

But that's up to you - it's fully stylable with CSS.

As well as text the widget can host arbitrary HTML content (see konsole.append(el)).

This is not an ANSI/VT100 terminal emulator!

Demo

echo-chamber is used by basica, my embeddable BASIC interpreter. Try it here!

Installation

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

Get it:

npm install echo-chamber

Require it:

var EchoChamber = require('echo-chamber');

UMD

Copy and paste either build/echo-chamber.js or build/echo-chamber.min.js into your project.

Default CSS

.console {
  line-height: 1.2;
  overflow: auto;
}

.console:focus {
  outline: none;
}

/* Shim text area for receiving keyboard input */
.console > textarea {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: none;
  overflow: hidden;
  background: none;
}

.console > textarea:focus {
  outline: none;
}

/* Line or other item */
.console > .item {}

/* Text line */
.console > .text {
  word-wrap: break-word;
}

/* Line currently receiving input */
.console > .input {}

/* Prompt */
.console > .item > .prompt {}

/* Cursor */
.console > .input > .cursor {}

API

var konsole = new EchoChamber(el, [opts])

Create a new console rooted in the empty div el.

Supported options:

  • capabilities: a Modernizr-like feature-detection object, used to detect support for touch devices via the touch key. 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 (console).
  • prompt: string or callback function for generating the prompt. Pass false if 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: 0.

konsole.getInput()

Returns the command that the user has entered. Throws an exception if console is not in the input state.

konsole.print(str)

Print a text string to the console.

konsole.append(el)

Append a DOM element to the console.

konsole.clearInput()

Clear the input bufer.

konsole.newline()

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.

konsole.focus()

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.

Use 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

© 2014 Jason Frame [ @jaz303 / jason@onehackoranother.com ]

Released under the ISC license.