Regarding this global: may be some other ways of implementation could help. Node is JS but it is not the birth place of JS. It was the browser, and in the browser there is an implicit 'global'... where all the things 'hang of', similar as in Smalltalk, where #Smalltalk is the global.
In a microcontroller context where resources are extremely scarce, some (software) technologies / techniques used in other contexts are not that overall beneficial. On the other hand - if developed in a simulation environment / cross-developed and then 'broken'/converted/transpiled down for the 'little cousin runtime environment - why not to use. Unfortunately, these transpilers & cie. are machines and deliver results not that easy for humans to consume... yes, I know, this already starts with source code maps... but for Espruino, they already cost the runtime code byte(s) for each of the functions.
I'm working on a StencilJS PWA-application, which works in Typescript, just like many other front-end applications. I started to convert https://www.puck-js.com/puck.js to a typescript module, but it's a bit tricky.
For now, I have put it in index.html and 'imported' window.Puck to use the Bluetooth connectivity.
© Espruino, powered by microcosm.
Report a problem