Static extension class for additional JavaScript-style methods.

The class is intended to be used using the using keyword.

Static methods

staticall<T>(promises:Iterable<Promise<T>>):Promise<Array<T>>

Returns a promise that is fulfilled when all the given promises are fulfilled or rejected with a reason of the first promise that is rejected.

staticallSettled<T>(promises:Iterable<Promise<T>>):Promise<Array<SettledOutcome<T>>>

Returns a promise that will be fulfilled with an array of outcome objects when all of the given promises are settled.

The object will have fields:

  • status (String) either "fulfilled" or "rejected"
  • value (T) when status is "fulfilled"
  • reason when status is "rejected"

If the method is not implemented on the JS target, use -D thenshim_js_fallback_allSettled to enable a fallback implementation. Objects are either FulfilledOutcome or RejectedOutcome, but using reflection (Reflect) instead of casting is recommended for cross-target compatibility.

staticcatch_<T, R>(promise:Promise<T>, onRejected:ThenableCallback<Any, Null<R>>):Promise<Null<R>>

Calls then with the onRejected callback.

staticfinally<T>(promise:Promise<T>, onFinally:Void‑>Void):Promise<T>

Calls a callback when the given promise settles.

If the method is not implemented on the JS target, use -D thenshim_js_fallback_finally to enable a fallback implementation.

staticrace<T>(promises:Iterable<Promise<T>>):Promise<T>

Returns a promise that will be settled with the value or reason of the first promise to fullfil or reject.