Skip to content

Commit

Permalink
feat(puppeteer): adds option object to be passed to the puppeteer go …
Browse files Browse the repository at this point in the history
…to call (#16)
  • Loading branch information
cbravo authored and JoshTheDerf committed Aug 14, 2018
1 parent 6d91e3b commit f7a8c2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ prerenderer.initialize()
| skipThirdPartyRequests | Boolean | No | `false` | Automatically block any third-party requests. (This can make your pages load faster by not loading non-essential scripts, styles, or fonts.) |
| consoleHandler | function(route: String, message: [ConsoleMessage](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-consolemessage)) | No | None | Allows you to provide a custom console.* handler for pages. Argument one to your function is the route being rendered, argument two is the [Puppeteer ConsoleMessage](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-consolemessage) object. |
| [[Puppeteer Launch Options]](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions) | ? | No | None | Any additional options will be passed to `puppeteer.launch()`, such as `headless: false`. |
| [[Puppeteer Navigation Options]](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagegotourl-options) | ? | No | None | Any additional options will be passed to `page.goto()`, such as `timeout: 30000ms`. |
---
Expand Down
5 changes: 3 additions & 2 deletions renderers/renderer-puppeteer/es6/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ class PuppeteerRenderer {
})
}, this._rendererOptions)
}

await page.goto(`${baseURL}${route}`, { waituntil: 'networkidle0' })

const navigationOptions = (options.navigationOptions) ? { waituntil: 'networkidle0', ...options.navigationOptions } : { waituntil: 'networkidle0' };
await page.goto(`${baseURL}${route}`, navigationOptions);

// Wait for some specific element exists
const { renderAfterElementExists } = this._rendererOptions
Expand Down

0 comments on commit f7a8c2d

Please sign in to comment.