I believe you can use Puck.
/getConnection() to get the currently active connection (you can use Puck.connect if not) and then you can do connection.on('close', function(d) { ... }) on that?
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.
You mean using the Puck.js library? (source at https://github.com/espruino/EspruinoWebTools/blob/master/puck.js)
I believe you can use
Puck. /getConnection()
to get the currently active connection (you can usePuck.connect
if not) and then you can doconnection.on('close', function(d) { ... })
on that?