Creates a new CancellablePromise.
A callback used to initialize the promise. This callback is passed three arguments: a resolve callback used to resolve the promise with a value or the result of another promise, a reject callback used to reject the promise with a provided reason or error, and an onCancel callback used to define behavior of cancellation.
Cancels the promise and invokes the cancellation callback if it was defined during instantiation. Cancellation will result in the promise being rejected.
Cancellable promise. Extends the functionality of the native Promise to include the cancel method.
Example: