Skip to content

Commit

Permalink
Lift MSG_OUTPUT_READY handling out of process_inbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorbin committed Apr 8, 2012
1 parent 60420c6 commit 4ff5269
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions ui/website/repl.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -368,6 +368,20 @@ var message_handlers = [];


message_handlers[MSG_OUTPUT_NULL] = function(msg) {}; // do nothing message_handlers[MSG_OUTPUT_NULL] = function(msg) {}; // do nothing


message_handlers[MSG_OUTPUT_READY] = function(msg) {
// remove the initializing message
$("#terminal").html("");

// enable input
$("#prompt").show();
$("#terminal-input").removeAttr("disabled");
$("#terminal-input").show();
$("#terminal-input").focus();

// reset the size of the input box
set_input_width();
};

// process the messages in the inbox // process the messages in the inbox
function process_inbox() { function process_inbox() {
// iterate through the messages // iterate through the messages
Expand All @@ -378,21 +392,6 @@ function process_inbox() {
if (typeof handler == "function") if (typeof handler == "function")
handler(msg); handler(msg);


// MSG_OUTPUT_READY
if (type == MSG_OUTPUT_READY) {
// remove the initializing message
$("#terminal").html("");

// enable input
$("#prompt").show();
$("#terminal-input").removeAttr("disabled");
$("#terminal-input").show();
$("#terminal-input").focus();

// reset the size of the input box
set_input_width();
}

// MSG_OUTPUT_MESSAGE // MSG_OUTPUT_MESSAGE
if (type == MSG_OUTPUT_MESSAGE) { if (type == MSG_OUTPUT_MESSAGE) {
// print the message // print the message
Expand Down

0 comments on commit 4ff5269

Please sign in to comment.