#How to pass variables from an ipcMain.on function to an outside variable?
13 messages · Page 1 of 1 (latest)
beginner
I don't know what my level is, I'm just a hobbyist.
do you know what scope is?
or eventloop?
how you supposed to use variables outside of other function?
why you didnt use global variables you assign values to?
ipcMain.on("ComPortBaundrateValues" happens after creating the object const port = new SerialPort(config), I think the problem is more related to creating this object dynamically through ipcMain.on("ComPortBaundrateValues", but if I do this this object will not be visible to other functions that use it...
How is it possible to make the object const port = new SerialPort(config) global?
declare variable in other scope
agora está funcionando 100%