Promise Manager

From CommonJS Spec Wiki
Jump to: navigation, search

Promise Manager

Promise manager provides a convenience API for handling promises.

Prior Art

Proposed API

A top-level 'promise' module should export the functions defined here:

http://waterken.sourceforge.net/web_send/

In addition, a promise module should export:

wait()
This will block the execution of the current function while waiting for the Promise to be fulfilled, *if* the implementation and this Promise support this operation. If supported, the function will return the result of the resolved Promise when it is fulfilled. If the Promise is resolved with an error, than this function will throw the provided error object. If the concurrency model of the implementation or the Promise object does not support blocking, the "wait" property should be a null or undefined. This API is not intended to imply that implementations that provide a "wait" function are superior.

Related Discussions

http://groups.google.com/group/commonjs/browse_thread/thread/e93f73ef97e88439/9cdb490abb8edfa6 http://groups.google.com/group/commonjs/browse_thread/thread/86fd52c9be191c4b