0
npmjs > jsdom에서 예제 코드를 가져 왔습니다. 이 프로세스는 몇 초 안에 수행되며 그 후에 만 console.log과 같은 두 번째 작업을 실행하려고합니다. 그러나 jsdom의 본문에 코드를 삽입하지 마십시오. 어쩌면 그것은 Node.js> Stream 과 작동합니다. 기능 체인을 만들면 이전 프로세스가 끝나 자마자 다음 프로세스가 시작됩니다.Node.js의 작업 순서
여기서 Node.js의 시퀀스를 읽을 수 있습니까?
var jsdom = require("jsdom");
jsdom.env({
url: "http://news.ycombinator.com/",
scripts: ["http://code.jquery.com/jquery.js"],
done: function (errors, window) {
var $ = window.$;
console.log("HN Links");
$("td.title:not(:last) a").each(function() {
console.log(" -", $(this).text());
});
}
});
console.log("The end");