future

Retrieves the value of a deferred as a Future.

Signature

future()
(Deferred 'f 's).() => Future 'f 's

Documentation

Retrieves the value of a deferred as a Future.

Properties

Source Code

Defined in source/concurrency/future/_deferred.js at line 58, column 21
future() {
    let future = new (Future());    // eslint-disable-line prefer-const
    this.listen({
      onCancelled: _      => moveToState(future, Cancelled()),
      onRejected:  reason => moveToState(future, Rejected(reason)),
      onResolved:  value  => moveToState(future, Resolved(value)) 
    });

    return future;
  }
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/)