How to expose a c/c++ module to Espruino JS?
For example, the jswrap_hello.c defines the 'Hello' class , it has a method 'world()', then we can do in Espruino:
How to expose 'Hello' as a module just like 'net' or 'Wifi'? I mean 'Hello' can be required like this:
var hello = require('Hello');
Just opening this again to mention this page, which has your answer: https://github.com/espruino/Espruino/blob/master/libs/README.md
Thank you, Gordon.
"type" : "library" , for a built-in module as a library,
and in JS code: var m = require('yourmodule');
"type" : "class" , for a built-in module as a Object,
and in JS code: yourmodule.method();
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem