hy/eg/tryhy/js/repl.js
2013-11-01 11:44:05 -07:00

19 lines
564 B
JavaScript

$(document).ready(function(){
$('#hy-console').console({
promptLabel: 'hy=> ',
commandValidate:function(line){
if (line == "") return false;
else return true;
},
commandHandle:function(line, report){
$.getJSON("/eval", {code: line}, function(data) {
report([{msg : data.stdout, className:"jquery-console-message-value"},
{msg : data.stderr, className:"jquery-console-message-error"}]);
});
},
animateScroll:true,
promptHistory:true,
autofocus:true,
}).promptText('(+ 41 1)');
});