<!DOCTYPE html>
<html><head></head><body>
<script>
datos = window.AppInventor.getWebViewString(); // Entrada de datos.
datos = datos + ":";
catetos = datos.split(":");
cateto1 = catetos[0];
cateto2 = catetos[1];
hipotenusa = Math.sqrt(Math.pow(cateto1, 2) + Math.pow(cateto2, 2)) ;
window.AppInventor.setWebViewString("" + hipotenusa); // Salida datos
</script>
</body></html>
- perro.png
We copy those three files in the folder: C:\rush\exe\win\dentro\assets
We edit: C:\rush\exe\win\dentro\rush.yml
assets:
# Extension icon. This can be a URL or a local image in 'assets' folder.
icon: icon.png
# Extension assets.
other:
- interno.txt
- perro.png
- pitagoras.htm
We add: - interno.txt, - perro.png and - pitagoras.htm
LOOK, the indentation is very important, respect the margins.
..\rush build
and get: com.juan.dentro.aix
Now with a decompiler, like Java Decompiler, we decompile the file com.juan.dentro.aix (change to com.juan.dentro.zip)
Notice that it contains an assets subfolder and inside are the files interno.txt, perro.png and pitagoras.htm
We see the root asset with the files: gato.png and saludos.txt, and the subfolder com.juan.dentro that contains: interno.txt, perro.png and pitagoras.htm
If you look at the blocks of the app, you will see that we can execute a JavaScript (pitagoras) with the htm file inside the extension.
We can also have images in the extension (perro.ng).
Also data in a text file (interno.txt)
Look at the address of these files when you are using the MIT Companion and when the app is installed.
Bare minimum, an extension that does not contain code.
We can use this extension to save images, text, javascript,... files, it has no function blocks or events.
<!DOCTYPE html>
<html><head></head><body>
<script>
datos = window.AppInventor.getWebViewString(); // Entrada de datos.
window.AppInventor.setWebViewString("" + getPrimes(datos)); // Salida
function getPrimes(max) {
var sieve = [], i, j, primes = [];
for (i = 2; i <= max; ++i) {
if (!sieve[i]) {
// i has not been marked -- it is prime
primes.push(i);
for (j = i << 1; j <= max; j += i) {
sieve[j] = true;
}
}
}
return primes;
}
</script>
</body></html>
It is in the media folder (assets).
I updated my private message response to you. Seems that File Exists does not work on your extension assets files nor on files in the normal assets. I tried all forms of file path, setting of the Screen filescope to Asset, to no avail - unless I am missing something obvious....