PromiseAdapter(api) → {PromiseAdapter}

new PromiseAdapter(api) → {PromiseAdapter}

Adapter for the primary promise operations.

Provides compatibility with promise libraries that cannot be recognized automatically, via functions that implement the primary operations with promises:

  • construct a new promise with a callback function
  • resolve a promise with some result data
  • reject a promise with a reason
  • resolve an array of promises

The type is available from the library's root: pgp.PromiseAdapter.

Parameters:
Name Type Description
api object

Promise API configuration object.

Passing in anything other than an object will throw TypeError = Adapter requires an api configuration object.

Properties
Name Type Description
create function

A function that takes a callback parameter and returns a new promise object. The callback parameter is expected to be function(resolve, reject).

Passing in anything other than a function will throw TypeError = Function 'create' must be specified.

resolve function

A function that takes an optional data parameter and resolves a promise with it.

Passing in anything other than a function will throw TypeError = Function 'resolve' must be specified.

reject function

A function that takes an optional error parameter and rejects a promise with it.

Passing in anything other than a function will throw TypeError = Function 'reject' must be specified.

all function

A function that resolves an array of promises.

Passing in anything other than a function will throw TypeError = Function 'all' must be specified.

Source:
Returns:
Type
PromiseAdapter