Has anyone gotten a web assembly (wasm) file working with DroidScript?

34 views
Skip to first unread message

Mike Stein

unread,
Jan 6, 2026, 4:48:36 AM (11 days ago) Jan 6
to DroidScript
Hi,

I previously tried to post a longer question as to whether developers can use web assembly files with DroidScript but am not sure the message got sent.

I tried using an already released node.js package:
https://www.npmjs.com/package/webr

but couldn't get it to work using DroidScript node app (npm package installed fine but crashes every time it tries to initialize .wasm). 

I also tried to make a straightforward DroidScript html app using the following developer's example:

```
<html>
  <head>
    <title>WebR Test Console</title>
  </head>
  <body>
    <div>
      <pre><code id="out">Loading webR, please wait...</code></pre>
      <input spellcheck="false" autocomplete="off" id="input" type="text">
      <button onclick="globalThis.sendInput()" id="run">Run</button>
    </div>
   
    <script type="module">
      /* Create a webR console using the Console helper class */
      import { Console } from 'https://webr.r-wasm.org/latest/webr.mjs';
      const webRConsole = new Console({
        stdout: line => document.getElementById('out').append(line + '\n'),
        stderr: line => document.getElementById('out').append(line + '\n'),
        prompt: p => document.getElementById('out').append(p),
      });
      webRConsole.run();
     
      /* Write to the webR console using the ``stdin()`` method */
      let input = document.getElementById('input');
      globalThis.sendInput = () => {
        webRConsole.stdin(input.value);
        document.getElementById('out').append(input.value + '\n');
        input.value = "";
      }
     
      /* Send input on Enter key */
      input.addEventListener(
        "keydown",
        (evt) => {if(evt.keyCode === 13) globalThis.sendInput()}
      );
    </script>
  </body>
</html>
```
which also doesn't work in a DroidScript html app but does work using a generic javascript IDE.

Appreciate any advice anyone can offer.

Thanks and best wishes to everyone for a good new year!


Dave

unread,
Jan 7, 2026, 5:41:53 AM (10 days ago) Jan 7
to DroidScript
I'm pretty sure I have had WASM working in a webview at some point, but I can't remember what it was.... possibly it was Python with this project - 
     https://github.com/pyodide/pyodide
Reply all
Reply to author
Forward
0 new messages