Open

Description
Hi,
Is there any place or person that has an extensive example of using the JS port?
I have basic a example working but had to use a bunch of hacks. The below list contains what I have been able to do, how I did it, and stuff that was/is not clear to me.
I am only interested in using it on webpages, not a server backend.
- Is there a prebuilt version of the port? I was able to do it finally in Linux but learned the hard way to not build it on Windows
- After including the micropython.js file through HTML and setting up the basic example as seen in the port's readme, I got undefined references to the 4 functions mentioned in the port's readme. I got around this by placing all my relevant code directly in micropython.js (not ideal) (although I now I see I may have to just wait on a timeout for the script to load before I use the functions, is there a flag I can check to see that the port JS loaded onto the page?)
- How do you use the module as a webworker/in a separate thread so it doesn't stall the page. If you were to use your own .js file, like 'myworker.js', then how do you successfully pass the micropython.js file to it? I got around this by directly using micropython.js to start the worker (which contains my custom code utilizing micropython.js)
- By doing the above workarounds the correct environment was not found, it looked like it was trying to use Node.js functions like the filesystem on the webpage and I had to comment all code causing undefined references.
- How can I have the page interact with micropython.js? Through the REPL? What if I spent time compiling the RP2040 port to emscripten the same way this port was, would I be able to override the machine.pin functions and set them through JS to simulate a button press?
That's a lot of complicated questions.