If you can find some example code to use CAN on an STM32 board then that would be a great starting point. If you can split it up into various functions (initialise, get data, set data) then it would be almost as easy as copy/pasting it into a file in Espruino.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Well, info on building Espruino is here:
https://github.com/espruino/Espruino
And creating your own C files is here:
https://github.com/espruino/Espruino/tree/master/libs
If you can find some example code to use CAN on an STM32 board then that would be a great starting point. If you can split it up into various functions (initialise, get data, set data) then it would be almost as easy as copy/pasting it into a file in Espruino.