I'm a novice programmer who recently discovered DroidScript and think it is a great Android IDE!
I was hoping to create a node.js app that imports the R language that has been converted to a module with wasm whose project is described here:
The webR project was an already very useful project in that users can access most of the power of R using their mobile devices to connect to servers serving webR. However, the online webR project requires users to download R packages each time one uses webR which makes using webR much less efficient that installed R and one must be online to use it. Unfortunately, there are no other efficient R apps for Android; one can run R via installing termux on Android but even that method requires additionally installing a Linux proot-distro on top of Termux.
However, the webR developers also created a npm version of webR, and thus I was hoping to create a DroidScript node project using the webR npm package so that I could run webR offline and install R packages on my Android device. I am able to install webR in a node project using DroidScript and even "require" the module. Yet, the project crashes whenever the DroidScript project attempts to initialize webR (which I presume is when it tries to utilize the associated wasm code). To ensure the DroidScript project wasn't crashing due to a conflict between the DroidScript app engine running and the webR module/wasm code, I created a DroidScript html project that contained only the exact html code on the webR developers website to create a test REPL and that also crashed (yet works when served as single file index.html from a desktop server).
Here is the html code that crashes in DroidScript html project:
```
<html lang="en">
<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>
```
Thank you and best wishes for a happy new year,
Sincerely,
Mike