minitest.html (837B)
1 <head> 2 <script src="lib/skulpt.min.js" type="text/javascript"></script> 3 <script src="lib/skulpt-stdlib.js" type="text/javascript"></script> 4 </head> 5 <body> 6 <script type="text/javascript"> 7 Sk.configure({}); 8 9 function runit() { 10 11 Sk.importMainWithBody("<stdin>", false, document.getElementById("yourcode").value, true); 12 // var prog = document.getElementById("yourcode").value; 13 // var myPromise = Sk.misceval.asyncToPromise(function() { 14 // return Sk.importMainWithBody("<stdin>", false, prog, true); 15 // }); 16 // myPromise.then(function(mod) { 17 // console.log('success'); 18 // }, 19 // function(err) { 20 // console.log(err.toString()); 21 // }); 22 } 23 </script> 24 25 <textarea id="yourcode" cols="40" rows="10">print("Hello World") 26 </textarea><br /> 27 <button type="button" onclick="runit()">Run</button> 28 29 </body>