Closed lygstate closed 2 years ago
Hi,
Please provide more information about what you tried, what didn't work, etc.
Promise.any is supported. Simply, being an asynchronous feature, one needs to use Context.execute_pending_job for it to be actually ran.
Promise.any
Context.execute_pending_job
Example:
import quickjs c = quickjs.Context() c.eval(""" a = 0; Promise.any([ Promise.resolve().then(() => {globalThis.a = 1;}), Promise.resolve().then(() => {globalThis.a = 2;}), ]); """) assert c.get("a") == 0 while c.execute_pending_job(): pass assert c.get("a") > 0
@lygstate Are you satisfied with the answer above? If so, I'll close this issue.
Hi,
Please provide more information about what you tried, what didn't work, etc.
Promise.any
is supported. Simply, being an asynchronous feature, one needs to useContext.execute_pending_job
for it to be actually ran.Example: