src/libs/Promise.js
function getPromiseCallbacks(oContext, sType) {
  return function () {
    var aCompleted, nLenPromises, oDeferred, aPromises, nPromise, oPromise, aResults = [];
    oContext.bCompleted = true;
    oContext.sType = sType;
    oContext.oResult = arguments;
    while (oContext.aPending[0]) {
      oContext.aPending.shift()[sType].apply(oContext, arguments);
    }
    oDeferred = oContext.oDeferred;
    if(oDeferred){
      aCompleted = [];
      aPromises = oDeferred.aPromises;
      nLenPromises = aPromises.length;
      aResults = [];
      for(nPromise = 0; nPromise < nLenPromises; nPromise++){
        oPromise = aPromises[nPromise];
        aCompleted.push(Number(oPromise.bCompleted));
        aResults.push( oPromise.oResult );
      }
      if(aCompleted.join('').indexOf('0') === -1){
        oDeferred[sType].apply(oDeferred, aResults);
      }
    }
  };
}
function getPromiseCallbacks(oContext, sType) {
  return function () {
    var aCompleted, nLenPromises, oDeferred, aPromises, nPromise, oPromise, aResults = [];
    oContext.bCompleted = true;
    oContext.sType = sType;
    oContext.oResult = arguments;
    while (oContext.aPending[0]) {
      oContext.aPending.shift()[sType].apply(oContext, arguments);
    }
    oDeferred = oContext.oDeferred;
    if(oDeferred){
      aCompleted = [];
      aPromises = oDeferred.aPromises;
      nLenPromises = aPromises.length;
      aResults = [];
      for(nPromise = 0; nPromise < nLenPromises; nPromise++){
        oPromise = aPromises[nPromise];
        aCompleted.push(Number(oPromise.bCompleted));
        aResults.push( oPromise.oResult );
      }
      if(aCompleted.join('').indexOf('0') === -1){
        oDeferred[sType].apply(oDeferred, aResults);
      }
    }
  };
}
Returns the promise callback by type
@param {Object}oContext
@param {String} sType
@return {Function}
@private