function myresult() {
return 'my result';
}
> Is there a way to call functions from an external JS script into the main JS
> script that is executed in casperJS?
You should write a module eg:
exports.myresult = function() {
return 'my result';
}
put this file in lib/mymodule.js and in casper you'll be able to
import it like this:
var mymodule = require('./lib/mymodule');
mymodule.myresult();
You can still alternatively use standard phantomjs' injectJs() of course:
phantom.injectJs('any/script/of/yours.js');
Cheers,
--
Nicolas Perriault
http://www.akei.com/ — http://prendreuncafe.com/
Mobile: +33 660 92 08 67 — Skype: nperriault