Bartozzz / crawlerr

A simple and fully customizable web crawler/spider for Node.js with server-side DOM. Comes with elegant and hell-simple APIs.
https://npmjs.com/package/crawlerr
MIT License
25 stars 7 forks source link

Fix .when() behaviour #38

Closed Dragnucs closed 6 years ago

Dragnucs commented 6 years ago

I dug a bit in the code and found that using a callback function makes the crawler work as expected using the when method.

The current behaviour as in issue #34 is because the promise only resolves once and the code inside then() is therefore only run once. Using a callback function and completely dropping the top most then method makes the crawler crawl again.

Please tell me what you think?

Bartozzz commented 6 years ago

Nice catch! I updated some tests and removed outdated code. Everything should work as expected now. Thanks for contributing!

Dragnucs commented 6 years ago

Thank you for merging.