-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnode_helper.js
More file actions
32 lines (27 loc) · 765 Bytes
/
node_helper.js
File metadata and controls
32 lines (27 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Magic Mirror
* Module: MMM-TTS
*
* By fewieden https://github.com/fewieden/MMM-TTS
*
* MIT Licensed.
*/
/* eslint-env node */
const NodeHelper = require('node_helper');
const tts = require('say');
module.exports = NodeHelper.create({
start() {
console.log(`Starting node helper for: ${this.name}`);
},
socketNotificationReceived(notification, payload) {
if (notification === 'CONFIG') {
this.config = payload;
} else if (notification === 'TTS') {
tts.speak(payload, this.config.voice, this.config.speed, (err) => {
if (err) {
console.log(err);
}
this.sendSocketNotification('HIDE', {});
});
}
}
});