In my "app.js" I have an async function waiting for a connection to become ready from my imported connection.js
I'm not sure how I can get app.js to function correctly with it's "await". In connection.js, I'm not able to add an export in the 'on' function, nor outside the on function.
I'm still learning promises/await's etc so pointers in the right direction would be appreciated.
app.js
var qlabconn = require('./qlab/connection.js');
// Wait for QLab connection, then we'll start the magic!
(async () => {
console.log('Ready!');
var qlabConnectionReady = await qlabconn.connectionReady;
//qlab.cues.x32_mute('1', "OFF");
console.log(qlabConnectionReady);
})();
connection.js
// On connection to QLab
qlabconn.on('ready', () => {
console.log('Connected to QLab!');
let connectionReady = new Promise(resolve => {
resolve(true)
});
(async () => {
await core.send_message(`/alwaysReply`, {"type" : 'f', "value" : 1})
})();
});