Quirrel4.41.0

async

Futures and the async runtime.

from "async" import ...

Future class

The result of an async call, available later.

Functions

allall([arr]): anyRuns every future in arr concurrently and fulfils with an array of their values, in input order, once every one of them fulfils.
constructorinstance.constructor()Constructs a pending Future
getStateinstance.getState(): stringReturns the lifecycle state: 'pending', 'fulfilled' or 'faulted'
getValueinstance.getValue(): anyReturns the settled value (fulfilled or fault value); throws while pending. A pure peek: reading a fault does not acknowledge it (see markHandled)
markHandledinstance.markHandled()Acknowledges a faulted Future so it is not reported as unhandled; does not consume the value (getValue still reads it)
racerace([arr]): anySettles as whichever future in arr settles first, fulfilled or faulted.
rejectinstance.reject([value])Faults a pending Future with value (default null); ignored if already settled
resolveinstance.resolve([value])Settles a pending Future with value (default null); ignored if already settled