Retrieves the value of a deferred as a Promise. Cancellations are mapped to a rejected promise with a special object.
Retrieves the value of a deferred as a Promise. Cancellations are mapped to a rejected promise with a special object.
promise() {
return new Promise((resolve, reject) => {
this.listen({
onCancelled: _ => reject(Cancelled()),
onResolved: resolve,
onRejected: reject
});
});
}