promise

Retrieves the value of a deferred as a Promise. Cancellations are mapped to a rejected promise with a special object.

Signature

promise()
(Deferred 'f 's).() => Promise 'f 's

Documentation

Retrieves the value of a deferred as a Promise. Cancellations are mapped to a rejected promise with a special object.

Properties

Source Code

Defined in source/concurrency/future/_deferred.js at line 58, column 21
promise() {
    return new Promise((resolve, reject) => {
      this.listen({
        onCancelled: _ => reject(Cancelled()),
        onResolved: resolve,
        onRejected: reject 
      });
    });
  }
Licence
MIT
Module
folktale/concurrency/future/_deferred
On This Page
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)