diff --git a/examples/scan-for-devices.js b/examples/scan-for-devices.js index fbf72ff..f2a75ee 100644 --- a/examples/scan-for-devices.js +++ b/examples/scan-for-devices.js @@ -9,4 +9,8 @@ scanner.on('deviceDiscovered', async ({ peripheral, model, modelName }) => { console.log('Discovered device:', device, peripheral, model, modelName); }); -scanner.stopScanningForDevices(); +process.on('SIGINT', () => { + console.log('Stopping DJI device scanner...'); + scanner.stopScanningForDevices(); + process.exit(); +});