A terminal/console emulator for JavaScript. Functionality is modelled on the .NET Console class.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo
README
jConsole.js

README

HiThere! This is pretty old and I haven't reviewed the code or approach but probably 
you should go look elsewhere if you're after something like this

jConsole

By Nik Coughlin

A terminal/console emulator for JavaScript. Functionality is modeled on the .NET 
Console class.

Usage:
  See the example in the demo folder, otherwise the API is:
   
  Initialize the console:
    var container = document.getElementById( "container" );
    jConsole.initializeConsole( container, 80, 25 );
    
    The signature for initializeConsole is:
      function( container, width, height )      
      
  Then you can:
    Clear the console:
      jConsole.clear();
      
    Hide/show the cursor:
      jConsole.hideCursor();
      jConsole.showCursor();
    
    Set the cursor position:
      jConsole.setCursor( 0, 5 );
      
      The signature for setCursor is:
        function( left, top )
    
    Change the console size:
      jConsole.setWindowSize( 80, 25 );
      
      The signature for setWindowSize is:
        setWindowSize: function( width, height )
        
    Write to the console:
      jConsole.write( "Hello World" );
       
      The signature for write is:
        function( value )
        
    Write to the console followed by a newline:
      jConsole.writeLine( "Hello World" );
      
      The signature for writeLine is:
        function( value )
    
    Set the current foreground color:
      jConsole.foregroundColor = "#888";
      
      You can use any CSS color value.
    
    Set the current background color:
      jConsole.backgroundColor = "#888";
      
      You can use any CSS color value.
      
    Blit to the whole console at once:
      jConsole.blit( tiles );
      
      The signature for blit is:
        function( tiles )
        
      tiles is a collection of tile:
        tile: { 
          C: <a character>, 
          F: <foreground color>, 
          B: <background color>
        }
      
      The collection should contain exactly height * width elements.

BUGS:
  Doesn't work locally in Chrome :( But works when uploaded to a remote site.
  Works in FF, IE, Safari, Opera. 
  
  Chrome has a bug with local stylesheets.
  
  In Chrome it complains about a line in getCSSRule:
    cssRule = styleSheet.rules[ii];
  The message is:  
    Uncaught TypeError: Cannot read property '0' of null

TODO:
  Add a jQuery wrapper
  Some comments might be nice
  Find a better name, plenty of Google hits for jConsole already
  Work around Chrome bug
  ???
  Profit