I am building my first custom module and in my configuration file I need to have a drop down list of files in a directory. I've got the basic dynamic build of the list working (thanks to the serial port module).
Everything works if I comment out these lines:
fs.readdirSync(testFolder).forEach(file => {
console.log(file);
})
But uncommented my drop down doesn't show up - seems to fail on this line and therefore stops executing code.
What am i missing?
oneditprepare: function() {
blist = buildlist(".");
var vswitch = "custom";
for (var i in blist) {
if (this.switches == blist[i].value) {
vswitch = this.switches;
}
}
$("#node-config-input-switches").typedInput({
default: this.switches,
types:blist
});
}, //end of on edit prepare
oneditsave: function() {
var mytype = $("#node-config-input-switches").typedInput('type');
$("#node-config-input-switches").typedInput('value',mytype);
this.switches = $("#node-config-input-switches").typedInput('value');
} //end of on edit save
});