Sha256: 8677fc5b2baa8aac74b92271b25815cdac0968670d47444feb886cf8bd4b3a1b

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

function emrun_register_handlers() {
  function post(msg) {
    var http = new XMLHttpRequest();
    http.open("POST", "stdio.html", true);
    http.send(msg);
  }
  // If the address contains localhost, or we are running the page from port 6931, we can assume we're running the test runner and should post stdout logs.
  if (document.URL.search("localhost") != -1 || document.URL.search(":6931/") != -1) {
    var emrun_http_sequence_number = 1;
    var prevExit = Module['exit'];
    var prevPrint = Module['print'];
    var prevErr = Module['printErr'];
    Module['exit'] = function emrun_exit(returncode) { post('^exit^'+returncode); prevExit(returncode); }
    Module['print'] = function emrun_print(text) { post('^out^'+(emrun_http_sequence_number++)+'^'+text); prevPrint(text); }
    Module['printErr'] = function emrun_printErr(text) { post('^err^'+(emrun_http_sequence_number++)+'^'+text); prevErr(text); }
  }
  // Notify emrun web server that this browser has successfully launched the page.
  post('^pageload^');
}
emrun_register_handlers();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webruby-0.2.7 modules/emscripten/src/emrun_postjs.js
webruby-0.2.5 modules/emscripten/src/emrun_postjs.js