News for hackers. Stuff that matters.
Re:Running TypeScript on ESP8266/ESP32 Devices by connicpu on Thursday March 03, 2022 @04:32PM (#30547310)
I'm curious and couldn't find the info from a quick search of the repo, how much flash space does the JS virtual machine take up? And how much space is left to include libraries you may need?

Between the Arduino runtime, wifi library, mqtt library, libraries for talking to peripherals, and my C++ application code I'm already getting pretty close to the 512KiB limit for an ESP8266-based thermostat I've been working on. Hard to imagine JS being small enough to fit on that, but perhaps it's designed for embedded chips with a bit more flash space available

Re:Running TypeScript on ESP8266/ESP32 Devices by __ryan__ on Thursday March 03, 2022 @04:50PM (#30547514)
This makes use of a JS interpreter made for embedded devices: Espruino

More details in the Espruino repo: https://github.com/espruino/Espruino

Re:Running TypeScript on ESP8266/ESP32 Devices by thamer on Thursday March 03, 2022 @04:48PM (#30547490)
I can't speak for a JS virtual machine, but for a point of comparison CircuitPython[1] runs on many ESP32 boards and builds are often under 1.5 MB. It does come with a whole set of modules, with the ones you'd expect to have in Python like "re" or "time" (although they only have a few functions in there), but also with CircuitPython-specific modules like "board" or "digitalio" to access peripherals, or "wifi" for networking.

The boards listed on the CircuitPython downloads page usually have between 2 and 8 MB of flash, so you often have enough for the VM and your own code plus a few files.

[1] https://circuitpython.org/

Re:Running TypeScript on ESP8266/ESP32 Devices by Already__Taken on Thursday March 03, 2022 @06:35PM (#30548571)
Well, related to espruino as linked below. Having the VM does allow it to handle power and sleep states for you by the nature of the VM understanding the scheduling that's required.
Re:Running TypeScript on ESP8266/ESP32 Devices by skittleson on Thursday March 03, 2022 @06:01PM (#30548224)
Devices memory vary in size https://en.wikipedia.org/wiki/ESP8266. Minification has been common with JS for years so it should be easy to add that in with the rollup.js build. Some checking be a nice to have.
Re:Running TypeScript on ESP8266/ESP32 Devices by scommab on Thursday March 03, 2022 @07:20PM (#30548905)
https://github.com/Moddable-OpenSource/moddable lets you do JS development targeting ESP8266/ESP32 .