hy/eg/tryhy/js/repl.js

19 lines
564 B
JavaScript
Raw Normal View History

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