Class: PromiseProvider

PromiseProvider

(abstract) new PromiseProvider()

The PromiseProvider class is the base class for providers of Promise instances.
A concrete implementation is required to implement PromiseProvider#newPromise so that this method returns a Promise that will be used by the library to do JMAP requests and other asynchronous things.

This level of abstraction allows users of the library to plug in their own implementation in order to use their favorite Promise library. Implementations for Q and native ES6 Promises are provided.

Source:
See:

Methods

(abstract) newPromise(resolver) → {Promise}

This method must be implemented by concrete PromiseProvider implementations in such a way that:

  • A Promise is created from the resolver argument and is returned.
  • The Promise will be fulfilled when the resolve function of the resolver is called.
  • The Promise will be rejected when the reject function of the resolver is called.
Parameters:
Name Type Description
resolver function

A Function with two arguments resolve and reject, both functions. The first argument fulfills the promise, the second argument rejects it.

Source:
Returns:
Type
Promise