You can check process.env.CONSOLE=="USB" - this will detect if Espruino has a connection to your PC (eg. it appears as a COM port).
process.env.CONSOLE=="USB"
However it has no way to know if you have an application running on the PC that is looking at what it is printing!
@Gordon 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.
You can check
process.env.CONSOLE=="USB"
- this will detect if Espruino has a connection to your PC (eg. it appears as a COM port).However it has no way to know if you have an application running on the PC that is looking at what it is printing!