Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the console works on codecademy.com/tryruby.org?

The websites I am talking about - codecademy.com and tryruby.org.

My guess would be that the console is a simple div with a key listeners "attached" to it. Whenever a user presses any key and submits it by pressing enter, the console just adds whatever he typed after the last letter in the div and "moves" the >> [type here part to last line of the div.

However, I'm not sure if that's so simple, so I would like to know what do other people think. I believe that it would be too inefficient - especially when we are talking about situation where the whole console is too stuffed with the text - adding any sign to the last line and moving the rest of the text up then would take too much time for browser to process.

like image 565
biphobe Avatar asked Aug 20 '11 05:08

biphobe


1 Answers

The commands are sent via AJAX to an actual Ruby interpreter, the explanation you provided is correct, but does not account for the fact that the commands provide any sensible results in the Ruby language.

like image 117
Uku Loskit Avatar answered Oct 21 '22 14:10

Uku Loskit