Can I write an async function in the max [js] object?
Hi there,
I'm doing a lot of patcher scripting and encountering some problems with certain aspects of my code being called before the max patcher is initialized, among other things. So I wondered about using an async function, but the js object is not accepting it. Leads me to wonder if async functions are even an option in max javascript?
Thanks for your help!
the js object - I'm pretty sure - uses ES3 (or similar), so it wouldn't support async functions. You could probably do what you're thinking with a callback function. Or (if you've got max8) use the [node.script] object to use nodejs, and then you should be able to use async funtions.
Thanks, Michael. I'm already using nodejs in my patch, and since I'm using the js object for patcher scripting, I found I could wrap the code in question in
function loadbang() {
gen_patcher = this.patcher.getnamed("name_of_gen~").subpatcher();
// etc...
}