Closed nesk closed 6 years ago
It is extremely unlikely that puppeteer will require a return value for events. For the same reason as you, we wouldn’t want marking functions as async to drastically change the behavior.
Oh, that's some good news! However, I think I will stick with this approach since its closer to the way JS works (the fact that functions are sync by default).
Thank you for the info!
Currently, it is impossible to use
await
in a JS function because the function isn't defined asasync
. Making all the JS functions async by default is not a good option because some Puppeteer's events could one day require a return value.A good option would be to add a chaining method to return an async JS function:
The above function creation would generate the following JS code:
Important: the documentation must be updated.
Method chaining should probably be implemented before dealing with this issue.