From d1f57137616a83fdeff7a6990fea7006fc4f41dd Mon Sep 17 00:00:00 2001 From: Thomas Lekanger Date: Thu, 2 Jan 2025 20:04:47 +0100 Subject: [PATCH] fix: don't instantly stop scanning in scan-for-devices example --- examples/scan-for-devices.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); +});