This has come up before...
Please see:
https://github.com/espruino/Espruino/issues/1168
It was deemed no longer an issue...
You could try the disconnected event mentioned in the link above, echo the details, and then attempt to reconnect.
@Wilberforce started
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.
This has come up before...
Please see:
https://github.com/espruino/Espruino/issues/1168
It was deemed no longer an issue...
You could try the disconnected event mentioned in the link above, echo the details, and then attempt to reconnect.