Sure, just spin up several PhantomJS processes. They are all self-contained, with the possible exceptions of caching/storage file location and, if using the "webserver" module, port number.
Alternatively, you could also have just a handful of PhantomJS processes that you keep running (think like a service) and then send data to them by various mechanisms: add a file to folder(s) that the PhantomJS instances are "watching", or have your PhantomJS instances listening to HTTP port(s) with the "webserver" module and send HTTP requests to them from your orchestrator process, or you could probably hookup some sort of WebSocket stream between PhantomJS and the orchestrator process, etc.
~~James
--
You received this message because you are subscribed to the Google Groups "phantomjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phantomjs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phantomjs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
var webpage = require('webpage');var page = webpage.create();page.content = '<script>for(;;);</script>';phantom.exit();
You are correct: because JavaScript is single-threaded, an individual PhantomJS process is also single-threaded.
~~James
This is also why modern browsers have a prompt to halt script execution for long-running scripts. Not sure if QtWebKit exposes such a signal for us to connect to but it would be very useful!
~~James
No signal, rather we just need to override the `QWebPage#shouldInterruptJavaScript` method:
http://qt-project.org/doc/qt-5.0/qtwebkit/qwebpage.html#shouldInterruptJavaScript
We already override that but we currently just tell it to keep processing. We could easily add a signal/callback there to allow the user to programmatically halt the script. If you are interested in thia functionality, please file a new issue for the feature request and then reply here with the link to it.
Thanks!
~~James