Hello, is it possible to use async/await or promises in Javascript functions?
It depends. Most of the functions in Appfarm are synchronous and do not allow for async/await. This is the case for function properties, function values, etc.
Run Code is asynchronous, but it uses a callback, and you need to create a wrapper for your code like this:
const myCode = async () => {
// Custom code with await here
}
myCode()
.then(resolve)
.catch(reject)
The editor in Appfarm will complain about your syntax, but it will work in most modern browsers.
Coded Component is also one place where you can run asynchronous code.