I am currently creating my own MM module, but am still relatively new to the platform so I used this tutorial to help me get started: https://forum.magicmirror.builders/topic/8534/head-first-developing-mm-module-for-extreme-beginners
It mentions that the node_helper.js is able to read from local files, but I’m having trouble getting it to work.
Here’s what my node_helper.js looks like so far:
var NodeHelper = require("node_helper")
var fs = require('fs')
module.exports = NodeHelper.create({
start: function() {
this.rawText = fs.readFileSync('YourTrueHome.txt').toString()
this.readIn = this.rawText.split('\r') //array of book line by line
this.text = this.readIn[1]
},
socketNotificationReceived: function(notification, payload) {
switch(notification) {
case "DO_YOUR_JOB":
this.sendSocketNotification("I_DID", this.text)
break
}
},
})
And then in the main js file, the socket notification receiver simply reads:
socketNotificationReceived: function(notification, payload) {
switch(notification){
case "I_DID":
let elem = document.getElementById("COUNT")
elem.innerHTML = "Count: " + payload
break
}
},
There is a COUNT element correctly defined in getDom: function() already.