Totally not a js dev. I'm using a js lib (puppete...
# javascript
c
Totally not a js dev. I'm using a js lib (puppeteer) that needs
const browser = await puppeteer.launch()
. My issue is that I can't use await with kotlin js, and I don't know if "await" is just syntactic sugar for a callback (sort of stuff done on Java with coroutines)
In JS,
async/await
is pretty much just syntactic sugar over the Promises API https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function. So if
puppeteer.launch()
needs to be awaited, it really just returns a
Promise
object, and you can then wrap that up in a Kotlin coroutine
c
Thanks, that's exactly what I was looking for
g