Skip to content
/ jConsole Public

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

Notifications You must be signed in to change notification settings

nrkn/jConsole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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  

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published