~lattis/meson-playground

a963476f0d9f53bf1326f84a891a6fdc69b283b2 — Stone Tickle 1 year, 2 months ago 44d735d
put muon version on page
1 files changed, 22 insertions(+), 1 deletions(-)

M main.js
M main.js => main.js +22 -1
@@ 67,7 67,7 @@ function stripEscapes(str) {
 */
var factory = require('./muon.js');

function muonRun(arguments) {
function muonRun(arguments, output) {
  factory({
    arguments: arguments,
    printErr: (function() {


@@ 83,6 83,18 @@ function muonRun(arguments) {
        }
      };
    })(),
    stdout: (function() {
      var str = '';
      return function(c) {
        str += String.fromCharCode(c);

        if (String.fromCharCode(c) == "\n") {
          if (output !== undefined) {
            output(str);
          }
        }
      }
    })(),
    stdin: (function() {
      var element = document.getElementById('input');
      var str = element.value;


@@ 142,4 154,13 @@ textarea.addEventListener('input', event => { textChanged(event.target); });
  }

  textChanged(element);

  var lineNo = 0;
  muonRun(['version'], (line) => {
    if (lineNo == 0) {
      const ver = line.trim().split(' ')[1];
      document.getElementById('ver').innerHTML = ver;
    }
    lineNo += 1;
  });
})();