Skip to content

Instantly share code, notes, and snippets.

@afrontend
Created July 2, 2017 04:19
Show Gist options
  • Save afrontend/ef9dd428b15e4b4869845126b92ddef1 to your computer and use it in GitHub Desktop.
Save afrontend/ef9dd428b15e4b4869845126b92ddef1 to your computer and use it in GitHub Desktop.
Async 모듈 사용전 도서 검색 코드
checkPointLimit = booklist.length;
appendBookId(booklist, body);
_.each(booklist, function(book, key) {
var o = _.clone(opt);
o.bookId = book.bookId;
var index = key;
searchDetail(o, function (err, exist) {
checkPoint = checkPoint + 1;
if (err) {
exist = false;
}
booklist[index].exist = exist;
if (checkPoint === checkPointLimit) {
if (getBook) {
getBook(null, {
startPage: opt.startPage,
totalBookCount: totalBookCount,
booklist: booklist
});
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment