41 回复
@eeandrew 这周刚好把 co 揉进了 thunks,https://github.com/thunks/thunks,可以交流~
贴个demo:
var Thunk = require('../thunks.js')();
var fs = require('fs');
var size = Thunk.thunkify(fs.stat);
Thunk(function* () {
// 3 concurrent stat()s at a time
var a = yield [size('.gitignore'), size('thunks.js'), size('package.json')];
var b = yield [size('.gitignore'), size('thunks.js'), size('package.json')];
var c = yield [size('.gitignore'), size('thunks.js'), size('package.json')];
console.log(a);
console.log(b);
console.log(c);
})(function* () {
// 9 concurrent stat()s
var a = [size('.gitignore'), size('thunks.js'), size('package.json')];
var b = [size('.gitignore'), size('thunks.js'), size('package.json')];
var c = [size('.gitignore'), size('thunks.js'), size('package.json')];
var d = yield [a, b, c];
console.log(d);
})(function* () {
var a = size('.gitignore');
var b = size('thunks.js');
var c = size('package.json');
var res = yield [a, b, c];
console.log(res);
})();
@zensh 我去,这不是angularjs.cn站长吗。已follow,已关注,正在拜读。话说三四年前teambition还在闵行紫竹的时候,我还在那里做过几天实习生。 现在已经这么好了,俊元实在是了不起!
@alsotang 北京搞node.js人应该是很多,不过大牛什么的 http://www.cnblogs.com/Darren_code/p/node_express.html 这个博主在北京 ,不过不知道怎么联系。