Promise Factory

Provides a factory containing methods for returning promises. These functions are available under the `convenienceApi.promiseFactory` namespace.

Methods

resolve()Promise
Returns a promise that is resolved with a specific value. For more information, see Promise.resolve() on the MDN web docs site.
reject()Promise
Returns a promise that is rejected with a specific reason. For more information, see Promise.reject() on the MDN web docs site.
all()Promise
Returns one of the following promises depending on the parameter passed to the method:
  • An already resolved promise when it is passed an iterable parameter, such as an array or an object, which is empty.
  • Asynchronously resolved promise when the iterable passed contains no promises.
  • A pending promise in all other cases.

Properties Details

resolve() ⇒ Promise

Returns a promise that is resolved with a specific value. For more information, see Promise.resolve() on the MDN web docs site.

Returns: Promise - A promise that resolves to a specific value.

reject() ⇒ Promise

Returns a promise that is rejected with a specific reason. For more information, see Promise.reject() on the MDN web docs site.

Returns: Promise - A promise that is rejected.

all() ⇒ Promise

Returns one of the following promises depending on the parameter passed to the method:

  • An already resolved promise when it is passed an iterable parameter, such as an array or an object, which is empty.
  • Asynchronously resolved promise when the iterable passed contains no promises.
  • A pending promise in all other cases.

Returns: Promise - A promise based on the parameter passed.