async.js 浏览器示例不完整

async.js browser example incomplete

[https://github.com/caolan/async][1]

正好有 1 个 "In the Browser" 示例,即:

<script type="text/javascript" src="async.js"></script>
<script type="text/javascript">
    async.map(data, asyncProcess, function(err, results){
        alert(results);
    });
</script>

但这不完整,因为 "data" 和 "asyncProcess" 未定义。 有人可以为这些变量提供简单的值吗 我可以看到一个工作示例吗? 非常感谢。

数据应该是一个项目数组。

[
  {log: "item1"},
  {log: "item2"}
]

asyncProcess 应该是一个以 item 和回调函数作为参数的函数:

function asyncProcess(item, callback){
  console.log(item.log);
  callback(null, item.log+" Done");
}

它在 async documentation

中也有详细记录