HipsterBrown / xs-dev

The quickest way for getting started with JS on devices
https://xs-dev.js.org
MIT License
37 stars 13 forks source link

docs: wasm simulator playground #130

Open HipsterBrown opened 1 year ago

HipsterBrown commented 1 year ago

It is possible to target wasm as a platform for the build/run commands with xs-dev and open the simulator in a browser by serving the output via a static file server. With this in mind, could it be feasible to create an online "playground" (see TypeScript, Docker, Pebble), that provides example programs running in the hosted simulator?

As the capabilities of the wasm simulator are expanded to include sensor data from the browser, simulated files, etc, then there might be a path to compiling user input as a "mod" to run in the wasm host program. This could also lead to flashing these examples to a local device, as demonstrated by esptool-js.

dashcraft commented 1 year ago

I've been too busy to devote much time to think through the hot reloading architecture, but this reminds me of https://wokwi.com/projects/322410731508073042

The esp32 in browser simulator we came across awhile back. They have a web component element kit, https://github.com/wokwi/wokwi-elements, that could probably be leveraged for open source stuff as well.

HipsterBrown commented 1 year ago

Oh that's a very cool project and very much what I'm imagining for this feature. They appear to have a rp2040 simulator as well https://github.com/wokwi/rp2040js

I have not tried extending the xs-sim functionality before but these could be very useful for the wasm target at least.