Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get "onResourceReceived" results back to Node through wrapper? #89

Open
systemxcom opened this issue Dec 2, 2014 · 0 comments
Open

Comments

@systemxcom
Copy link

In webshot.phantom.js, I can get back the results of this option by grabbing the args array. Is there anyway to get the args array back to Node through your wrapper?

Option:
onResourceReceived: {
fn: function(response) {
}, context: {urlSource: urlLoc, capId: fileName},},

webshot.phantom.js
/*
* Bind the function fn to the context context in a serializable manner.
* A tiny bit of a hack.
*
* @param (String) fn
* @param (Object) context
*/
function buildEvaluationFn(fn, context) {
return function() {
var args = Array.prototype.slice.call(arguments);
console.log(JSON.stringify(context))
var adHost = args[0]['url'];
console.log(adHost);
page.evaluate(function(fn, context, args) {
eval('(' + fn + ')').apply(context, args);
}, fn, context, args);
};
}

@systemxcom systemxcom changed the title Cannot access "page.content" How to get "onResourceReceived" results back to Node through wrapper? Dec 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant