3 ms·
In Javascript: Promise is read-only (public interface), Deferred is writable (private) on JVM: Future is read-only (public), Promise is writable (private) The
by dustingetz 11y ago
In Javascript: Promise is read-only (public interface), Deferred is writable (private)
on JVM: Future is read-only (public), Promise is writable (private)
The writable interface has "resolve" and "reject" to return a value. The readable interface has "then", "error", "finally" etc which let you compose and combine functions that deal in asynchronous values.
The best Javascript implementation of promises is Bluebird, which doesn't expose a Deferred instance to avoid confusion, it is very nice. bluebirdjs.com/docs/api-reference.html