Open nrabinowitz opened 12 years ago
Better option here:
complete
callback option, in the PhantomJS scope, with page
as an argumentpage.manager
as a pointer to the SuiteManagerSuiteManager.endSuite()
and SuiteManager.endAllSuites()
to control flow.It's relatively simple to end the current suite (set its urls
array to []
) and to end all suites (that, plus setting suites = []
). Killing the ancestor of the current suite in a recursive situation might be more difficult - it's worth thinking about whether I'd want/need an actual tree structure to manage the suites if I wanted more fine-grained control.
Use case:
I think this would need to be addressed by setting a flag (maybe on the _pjs.state object?) to end the suite early, which could be checked in the page completion callback, emptying out the array of still-to-scrape pages. Question: this only affects the current level of recursion. Is that good? Do we need an early exit from the entire suite?