lib/phantom.js
function (filename, callbackFn) {
                var self = this;
                request.post(this.options.hostAndPort + '/phantom/functions/injectJs', {form:{args:JSON.stringify(arguments)}},
                    function (error, response, body) {
                        if (response.statusCode === 200) {
                            callbackFn && callbackFn.call(self, body);
                        }
                        else {
                            console.error(body);
                            throw new Error(body);
                        }
                    });
            }
function (filename, callbackFn) {
                var self = this;
                request.post(this.options.hostAndPort + '/phantom/functions/injectJs', {form:{args:JSON.stringify(arguments)}},
                    function (error, response, body) {
                        if (response.statusCode === 200) {
                            callbackFn && callbackFn.call(self, body);
                        }
                        else {
                            console.error(body);
                            throw new Error(body);
                        }
                    });
            }
function ( filename , callbackFn ) { var self = this ; request . post ( this . options . hostAndPort + '/phantom/functions/injectJs' , { form : { args : JSON . stringify ( arguments ) } } , function ( error , response , body ) { if ( response . statusCode === 200 ) { callbackFn && callbackFn . call ( self , body ) ; } else { console . error ( body ) ; throw new Error ( body ) ; } } ) ; }
Injects external script code from the specified file. If the file can not be found in the current directory, libraryPath is used for additional look up. This function returns true if injection is successful, otherwise it returns false.
Injects external script code from the specified file . If the file can not be found in the current directory libraryPath is used for additional look up . This function returns true if injection is successful otherwise it returns false .