Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Moddable IoT JavaScript Engine: 99% ES2017 Compliance with Requirement of Less Than 32KB RAM

Moddable IoT JavaScript Engine: 99% ES2017 Compliance with Requirement of Less Than 32KB RAM

The Moddable SDK provides a JavaScript engine for IoT development that supports greater than 99% compliance with the ES2017 specification and can run on devices with as little as 32KB RAM.

Moddable's SDK combines the XS JavaScript engine with graphics, networking, and various tools including debugger and simulator. The SDK also includes the Piu user interface framework designed to run on microcontrollers. The Moddable XS7 release targets ES2017, and the current master branch of XS passes greater than 99% of tests for the ES2018 specification.

To help developers get started, Moddable Zero provides reference hardware with a small touchscreen for $20 plus shipping and tax, aiming to keep the hardware affordable:

All the components in Moddable Zero have been selected to keep the cost low. The two main components are the NodeMCU board and the touch screen. The NodeMCU module carries the ESP8266, Wi-Fi antenna, Flash ROM, FTDI chip, and USB connector. The touch screen is an unbranded QVGA (240 x 320) display with 16-bit pixels driven by an ILI9341 display controller and an XPT2046 resistive touch controller. We'd like to use a capacitive touch display, but the prices are still considerably higher. That said, our touch driver delivers reliable touch input with the XPT2046.

Moddable is one of many JavaScript engines, though it compares favorably to other microcontroller focused engines with regards to support for newer JavaScript language features at a size suitable for microcontrollers. System requirements and specification support for various engines include:

  • Duktape 160KB flash RAM and 64KB system RAM, complete ES5.1 support, subset of ES2015 and newer features
  • Espruino 128KB flash RAM and 8KB system RAM, partial ES2015 support
  • JerryScript, 64KB flash RAM and 200KB ROM, complete ES5.1 support
  • mJS, 50KB flash RAM, 1KB system RAM, subset of ES2015 support

The Moddable presentation at TC-39 provides a solid explanation of how Moddable gets built and how a modern JavaScript engine can fit into devices with minimal memory.

At the 2018 FullStack conference, JavaScript creator Brendan Eich mentioned Moddable when asked what excited him most today about JavaScript:

Moddable has ES6 without eval, without the parser, running in 48K of ROM and 48K of RAM. That's pretty impressive. They're using some of the object.freeze affordances in ES6 to put things in ROM. It's amazing.

Moddable is available under a combination of open source licenses including GPL 3.0, LGPL 3.0, Apache 2.0, and Creative Commons Attribution 4.0. Moddable is also available under a commercial license. Contributions are welcome via the Moddable GitHub project, in particular, modules extending Moddable.

Rate this Article