0

我对如何使用co包使我的以下异步代码更具可读性 感到困惑https://www.npmjs.com/package/co

async.each(longList, function(address, callback) {

  googleMapsClient.geocode({
    address: address
    }, function(err, response) {

      // send the response to database
      http.request(options, function(res) {

        // now process the next address
        callback();
      });

   }

}, function(err) {
   if (err) throw err;
}

我也欢迎任何其他风格的上述编码,无论使代码更清晰

4

0 回答 0