added ability to pass custom function to phantomjs-node for stdout and stderr