From eb016414767f60e57f7695fea5056dabdbb9690d Mon Sep 17 00:00:00 2001 From: fewieden Date: Wed, 7 Jun 2017 17:45:30 +0200 Subject: [PATCH] bugfix --- CHANGELOG.md | 7 +++++++ node_helper.js | 20 +++++++++++++------- package.json | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75bf570..59387bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # MMM-voice Changelog +## [1.0.2] + +### Fixed + +* Restored context for handleData, logDebug and logError +* DeprecationWarning: Calling async function without callback (noop function) + ## [1.0.1] ### Added diff --git a/node_helper.js b/node_helper.js index f219dfe..1fda9c4 100644 --- a/node_helper.js +++ b/node_helper.js @@ -204,14 +204,20 @@ module.exports = NodeHelper.create({ this.startPocketsphinx(); - fs.unlink(`${filename}.log_pronounce`); - fs.unlink(`${filename}.sent`); - fs.unlink(`${filename}.vocab`); - fs.unlink(`TAR${filename}.tgz`); + fs.unlink(`${filename}.log_pronounce`, this.noOp); + fs.unlink(`${filename}.sent`, this.noOp); + fs.unlink(`${filename}.vocab`, this.noOp); + fs.unlink(`TAR${filename}.tgz`, this.noOp); } }); }, + /** + * @function noOp + * @description Performs no operation. + */ + noOp() {}, + /** * @function startPocketsphinx * @description Starts Pocketsphinx binary. @@ -225,13 +231,13 @@ module.exports = NodeHelper.create({ microphone: this.config.microphone }); - this.ps.on('data', this.handleData); + this.ps.on('data', this.handleData.bind(this)); if (this.config.debug) { - this.ps.on('debug', this.logDebug); + this.ps.on('debug', this.logDebug.bind(this)); } - this.ps.on('error', this.logError); + this.ps.on('error', this.logError.bind(this)); this.sendSocketNotification('READY'); }, diff --git a/package.json b/package.json index 0931fcf..18a2582 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mmm-voice", - "version": "1.0.1", + "version": "1.0.2", "description": "Voice Recognition Module for MagicMirror2", "scripts": { "lint": "./node_modules/.bin/eslint . && ./node_modules/.bin/stylelint .",