LoginSignup
7
8

More than 5 years have passed since last update.

async#forEach の最も簡単な例

Posted at
var async   = require('async');
/**
 * output:
 *    1
 *    2
 *    3
 *    undefined
 *    end
 */
async.forEach([1, 2, 3], function(data, cb) { // iteration で呼ばれる
  console.log(data);
  cb();
}, function (err) { // 全部おわったら or error があると呼ばれる
  console.log(err);
  console.log("end");
});

インストールは npm install async。 (current version: 0.1.18)

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8