~fd/cane-lang

e9ed844bf3d7907c1800ddbdd619682bf9e1f350 — Ersei Saggi 10 months ago 1f6a599
Remove alert() because srht.site doesn't like it
2 files changed, 8 insertions(+), 8 deletions(-)

M cane-wasm/index.html
M cane-wasm/src/lib.rs
M cane-wasm/index.html => cane-wasm/index.html +6 -4
@@ 69,13 69,15 @@ arg1 arg2 arg3 (space separated)</textarea
        return false
      })()

      if (!supported) {
        alert('WebAssembly not supported! This playground will not function.')
      }
      import init, { interpreter } from './pkg/cane_wasm.js'
      window.writeOut = function writeOut(text) {
        document.getElementById('output').innerText += text
      }
      if (!supported) {
        document.getElementById('output').innerText = ''
        writeOut('WebAssembly not supported! This playground will not function.')
      }

      import init, { interpreter } from './pkg/cane_wasm.js'

      document.getElementById('run').onclick = function () {
        document.getElementById('output').innerText = ''

M cane-wasm/src/lib.rs => cane-wasm/src/lib.rs +2 -4
@@ 1,6 1,6 @@
use wasm_bindgen::prelude::*;

use cane::stdtypes::{Data,Types};
use cane::stdtypes::{Data, Types};

use cane::Interpreter;
use std::collections::HashMap;


@@ 9,8 9,6 @@ use std::io::{Cursor, Write};

#[wasm_bindgen]
extern "C" {
    pub fn alert(s: &str);
    
    pub fn writeOut(s: &str);
}



@@ 56,6 54,6 @@ pub fn interpreter(input: &str, args_str: &str) {

    match runner.execute() {
        Ok(..) => (),
        Err(text) => alert(&text.to_string()),
        Err(text) => write!(stdout, "{}", text).unwrap(),
    }
}