Abstract over the target's promise implementation.

Static variables

@:value(new _Factory())staticfactory:PromiseFactory = new _Factory()

Factory that calls the methods to create promises on the current target.

Static methods

staticreject<T>(reason:Any):Promise<T>

Returns a settled promise that is rejected with the given reason.

staticresolve<T>(object:ValueOrPromiseLike<T>):Promise<T>

Returns a settled promise or flattened promise.

  • When given a value, it returns a settled promise that is fulfilled with the given value (as a convenience function).
  • When given a Promise, it returns the promise itself.
  • When given a Thenable, it returns a new promise that reflects the Thenable's state.

Constructor

@:impl@:noCompletionnew(executor:PromiseExecutor<T>)

Wrap an implementation as a JavaScript-style promise.

Parameters:

executor

Callback function with resolve and reject functions.

Methods

@:implthen<R>(onFulfilled:ThenableCallback<T, R>, ?onRejected:ThenableCallback<Any, R>):Promise<R>

Calls the given callbacks when this promise is settled.

See also: