Closed nesk closed 6 years ago
Currently, it is not possible to provide a Node resource in JS function scopes, like this:
$page = (new Puppeteer)->launch()->newPage(); $page->on( 'domcontentloaded', JsFunction::create('page.content().then(console.log)', ['page' => $page]) );
This could be done by storing the required resources in Node's global object. The above function creation would generate the following JS code:
global
return function () { var page = global.puphpeteerResources['a-unique-id-to-the-resource']; page.content().then(console.log); };
Original idea from nesk/puphpeteer#9 by @john-f-chamberlain
Currently, it is not possible to provide a Node resource in JS function scopes, like this:
This could be done by storing the required resources in Node's
global
object. The above function creation would generate the following JS code:Original idea from nesk/puphpeteer#9 by @john-f-chamberlain