Edit: this (my suggestion) is not going to work for you. The callback fires immediately on upload, no connection required.
Send some dummy data? This method offers a callback on send. But I don't know if this guarantees data is received, and by extension a connection. Suspect not.
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.
Edit: this (my suggestion) is not going to work for you. The callback fires immediately on upload, no connection required.
Send some dummy data? This method offers a callback on send. But I don't know if this guarantees data is received, and by extension a connection. Suspect not.
https://www.espruino.com/Reference#l_NRF_sendHIDReport
The ble_hid_keyboard module uses it: https://www.espruino.com/modules/ble_hid_keyboard.js