lib/proxy.js
function (options, callbackFn) {
            var self = this;

            //compensate for optional options parm
            if (typeof options === 'function') {
                callbackFn = options;
                options = {};
            }

            //assign default port
            options.port = options.port || 1061;
            options.host = options.host || 'localhost';
            options.hostAndPort = 'http://' + options.host + ':' + options.port;
            options.eventStreamPath = require('path').normalize(__dirname + '/../temp/events.txt');
            options.phantomjsPath = options.phantomjsPath || 'phantomjs';

            options.debug && console.log('creating proxy to %s', options.hostAndPort);

            this.options = options;

            //try starting server
            createServer.call(self, options, function (proxy) {
                callbackFn.call(self, proxy);
            });

            return this;//return this to chain end
        }
function (options, callbackFn) {
            var self = this;

            //compensate for optional options parm
            if (typeof options === 'function') {
                callbackFn = options;
                options = {};
            }

            //assign default port
            options.port = options.port || 1061;
            options.host = options.host || 'localhost';
            options.hostAndPort = 'http://' + options.host + ':' + options.port;
            options.eventStreamPath = require('path').normalize(__dirname + '/../temp/events.txt');
            options.phantomjsPath = options.phantomjsPath || 'phantomjs';

            options.debug && console.log('creating proxy to %s', options.hostAndPort);

            this.options = options;

            //try starting server
            createServer.call(self, options, function (proxy) {
                callbackFn.call(self, proxy);
            });

            return this;//return this to chain end
        }
function ( options , callbackFn ) { var self = this ; //compensate for optional options parm if ( typeof options === 'function' ) { callbackFn = options ; options = { } ; } //assign default port options . port = options . port || 1061 ; options . host = options . host || 'localhost' ; options . hostAndPort = 'http://' + options . host + ':' + options . port ; options . eventStreamPath = require ( 'path' ) . normalize ( __dirname + '/../temp/events.txt' ) ; options . phantomjsPath = options . phantomjsPath || 'phantomjs' ; options . debug && console . log ( 'creating proxy to %s' , options . hostAndPort ) ; this . options = options ; //try starting server createServer . call ( self , options , function ( proxy ) { callbackFn . call ( self , proxy ) ; } ) ; return this ; //return this to chain end }
creates a new proxy session - creates phantomjs process and webserver module
creates a new proxy session - creates phantomjs process and webserver module