From 57fc3dff2d7e49c72b386a94913e11a65976acab Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 23 Aug 2017 21:23:55 +0800 Subject: [PATCH] add ctrl+c closeSerial --- app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.js b/app.js index 6c85a13..abbd305 100644 --- a/app.js +++ b/app.js @@ -31,6 +31,7 @@ bleno.on('advertisingStart', function (error) { }) localEvent.on('print', async (str) => { + console.log(`get printer string >>> \n${str}`) let status = false if (printer.isOpen) { try { @@ -41,4 +42,8 @@ localEvent.on('print', async (str) => { } localEvent.emit('printResult', status) +}) + +process.on('SIGINT', () => { + printer.close() }) \ No newline at end of file