IDE/IDE/assets/js/uiop.js
//def of function to run code
def of function to run code
def of function to run code
function runCode(){  
    var code = Blockly.JavaScript.workspaceToCode(workspacePlayground);
     Blockly.JavaScript.INFINITE_LOOP_TRAP = null;
    document.getElementById("code_run").innerHTML ="";
      document.getElementById("code_run").innerHTML="HELLO";
   var outputArea = document.getElementById('code_run');
    alert(text);
    var myInterpreter = null;
    function initApi(interpreter, scope) {
      interpreter.setProperty(scope, 'alert',
          interpreter.createNativeFunction(function(text) {
        text = text ? text.toString() : '';
        document.getElementById("code_run").innerHTML += '\n' + text;
      }));
      var wrapper = function(text) {
        text = text ? text.toString() : '';
        return interpreter.createPrimitive(prompt(text));
      };
      interpreter.setProperty(scope, 'prompt',
          interpreter.createNativeFunction(wrapper));
      var wrapper = function(id) {
        id = id ? id.toString() : '';
        return interpreter.createPrimitive(highlightBlock(id));
      };
      interpreter.setProperty(scope, 'highlightBlock',
          interpreter.createNativeFunction(wrapper));
    }  
var myInterpreter = new Interpreter(code, initApi);  
    myInterpreter.run();
}
function runCode ( ) { var code = Blockly . JavaScript . workspaceToCode ( workspacePlayground ) ; Blockly . JavaScript . INFINITE_LOOP_TRAP = null ; document . getElementById ( "code_run" ) . innerHTML = "" ; document . getElementById ( "code_run" ) . innerHTML = "HELLO" ; var outputArea = document . getElementById ( 'code_run' ) ; alert ( text ) ; var myInterpreter = null ; function initApi ( interpreter , scope ) { interpreter . setProperty ( scope , 'alert' , interpreter . createNativeFunction ( function ( text ) { text = text ? text . toString ( ) : '' ; document . getElementById ( "code_run" ) . innerHTML += '\n' + text ; } ) ) ; var wrapper = function ( text ) { text = text ? text . toString ( ) : '' ; return interpreter . createPrimitive ( prompt ( text ) ) ; } ; interpreter . setProperty ( scope , 'prompt' , interpreter . createNativeFunction ( wrapper ) ) ; var wrapper = function ( id ) { id = id ? id . toString ( ) : '' ; return interpreter . createPrimitive ( highlightBlock ( id ) ) ; } ; interpreter . setProperty ( scope , 'highlightBlock' , interpreter . createNativeFunction ( wrapper ) ) ; } var myInterpreter = new Interpreter ( code , initApi ) ; myInterpreter . run ( ) ; }
def of function to run code
def of function to run code
/*var code = Blockly.JavaScript.workspaceToCode(workspacePlayground);
  Blockly.JavaScript.INFINITE_LOOP_TRAP = null;
  try {
    eval(code);
      document.getElementById().innerHTML=eval(code);
  } catch (e) {
    alert(MSG['badCode'].replace('%1', e));
  }*/ //var myInterpreter = new Interpreter(code); // document.getElementById("code_run").innerHTML="hello" // Add an API function for the alert() block, generated for "text_print" blocks. // Add an API function for the prompt() block. // Add an API function for highlighting blocks.