The promise() function returns callable object(function) that has method .then(onFulfilled, onRejected)
The promise is created as:
var prom = promise();
call it as prom(true, params). Where the params is an array of values that will be applied to onFulfilled callback functions registered by .then() method.
call it as prom(false, params). Where the params is an array of values that will be applied to onRejected callbacks registered by .then() method.
The promise.tis also redefines the Element.request() method - http get/post/put/delete call. So with this module included the Element.request() can be called in one of three forms:
.then(onsuccess,onfailure) call of the promise.