0

我正在导出一个返回承诺的函数。当我在顶部返回此函数时,承诺会按预期解决。但是,如果我在最终函数(或系列中的任何函数)中返回承诺,则承诺根本不会解决或工作。

module.exports = function() {

  //- - - - - - - -- - - - -
  //If i resolve the promise here it works as expected
  return Promise.resolve();
  //- - - - - - - -- - - - -

  async.series({
    ....
    someFunction: function(cb){
     cb();
    },
    ....
  }, function(err, results) {
    //- - - - - - - -- - - - -
    //but if I resolve the promise here it doesn't work
    return Promise.resolve();
    //- - - - - - - -- - - - -
  });

}

任何帮助将不胜感激!

4

0 回答 0